Sign in to follow this  
Followers 0
a_bubas_sign

Arrays

5 posts in this topic

What is the simplest way to move a single dimension array into the column (or row) of a two dimensional array?

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Dim $aIn[10] 
Dim $aOut[10][2]

; fill $aIn with something

for $x = 0 to ubound($aIn) -1
    $aOut[$x][0] = $aIn[$x]
Next

EDIT: Added -1 on the For statement

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I think JdeB meant UBound($aIn) - 1, otherwise you will get an overflow error.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks guys I am already doing something similar. Guess I should have posted the code. :D I was using the "While . . . Wend" statement set. Is the "For . . . Next" any faster? I was actually hoping there was a way do this on one line of code like a simple assignment : $2darray[1] = $1darray but I guess that would be to easy.

Thanks again.

Edited by a_bubas_sign

Share this post


Link to post
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
Sign in to follow this  
Followers 0