Jump to content

Redim'ing a 2-dim array into 1-dim


Recommended Posts

I have a 2 dimension array that I want to copy but I only need the first dim.

I tried

$a1DimArray = $a2DimArray
REDIM $a1DimArray[$a2DimArray[0][0]]

...hoping that the rest of the array would just be truncated off. I got back a single dimed array with the correct number of elements that were all blank.

Is this possible or do I have to parse the 2 dim array and move the values into the 1 dim array?

EDIT: Thinking about this some more I think I just have to parse the array...the first column I want is the 0 column of the second dimension... :whistle:

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Link to comment
Share on other sites

Yeah. That works.

Still a 2 dimension array...just with a signle dimension aspect.

Thanx

EDIT: No joy. It still is structured like a 2-dim array so calls to it have to be in the format: $array[$i][0].

I was hoping that I could get away with $array[$i] but after thinking about it, I'm pretty sure it isn't possible.

I'm trying to truncate a 2-dim into a 1 dim and that just isn't going to happen. What you did is truncate all but the first row of the second dim...but it's still a 2 dim array.

Nice try though.

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...