sensalim Posted September 6, 2011 Share Posted September 6, 2011 Let's say I have a 2D array, how do I add them using for loop? Source: 1=description 1 title=title 1 price=100 title=title 1b price=99 2=description 2 title= title 2 price=80 Desired final array: 1 // title 1 // 100 1 // title 1b // 99 2 // title 2 // 80 How do I do that? Thanks! Link to comment Share on other sites More sharing options...
MvGulik Posted September 7, 2011 Share Posted September 7, 2011 Can _ArrayAdd work with multi-dim array?Nope -> manual: @error: 2 -> $avArray is not a 1 dimensional array.Leaving the code request for others.In the mean time you could take a look(help) at Ubound() and ReDim. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
JoHanatCent Posted September 7, 2011 Share Posted September 7, 2011 Let's say I have a 2D array, how do I add them using for loop? Source: 1=description 1 title=title 1 price=100 title=title 1b price=99 2=description 2 title= title 2 price=80 Desired final array: 1 // title 1 // 100 1 // title 1b // 99 2 // title 2 // 80 How do I do that? Thanks! Try: #include <Array.au3> Global $First[2][3] = [["1", "title 1", "100"],["1", "title 1b", "99"]] Global $Second[2][3] = [["2", "title 2", "80"],["2", "title 2b", "79"]] $1 = UBound($First) $2 = UBound($Second) $3 = $1 + $2 $4 = 0 ReDim $First[$1 + $2][3] For $i1 = $1 To $3 - 1 For $i2 = 0 To 2 $First[$i1][$i2] = $Second[$4][$i2] Next $4 += 1 Next _ArrayDisplay($First) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now