ericnail Posted September 27, 2010 Share Posted September 27, 2010 Is is possible to set multiple Arrays like so: For $i = 0 to 7 $var[$i] = $ReturnVar ;$ReturnVar would return 10 different results Next Where $var[$i] would be cycling through 8 variables (Arrays) and (Hopefully) adding 10 returns to the second array. I would like it to essentially result in this: $var[0][0] = return 1 $var[0][1] = return 2 $var[0][2] = return 3 $var[0][3] = return 4 etc, etc.. $var[1][0] = return 1 $var[2][1] = return 2 $var[3][2] = return 3 $var[4][3] = return 4 etc, etc.. I currently am set like this: $var0 = $ReturnVar $var1 = $ReturnVar $var2 = $ReturnVar $var3 = $ReturnVar etc, etc.. Which of course returns this: $var0[0] = return 1 $var0[1] = return 2 $var0[2] = return 3 $var0[3] = return 4 And I continue that with all 8 variables.. Thanks Guys, Eric Link to comment Share on other sites More sharing options...
LurchMan Posted September 27, 2010 Share Posted September 27, 2010 (edited) If you have 2 (or more) arrays and just want to combine them then look at _ArrayConcatenate () in the help file. I'm not quiet sure why you want to use the 2D array though.. Edited September 27, 2010 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
meisandy Posted September 27, 2010 Share Posted September 27, 2010 (edited) ericnail,If I'm understanding you right: - You want to set data in array named:$Array1$Array2$Array3$Array4etc, etcInwhich case "Eval" seems appropiate, it returns a varible to use from a string! So, try this (not tested - but along these lines):For $i = 1 To 4 $VarToSetValue = Eval("Array" & $i) $VarToSetValue = $ReturnValue Assign("Array" & $i, $VarToSetValue) NextEDIT: When Using this with array's: ONLY delete the line " $VarToSetValue = $ReturnValue" and replace it with array add or whatever!If you really need to use a 2D array, try this to replace array add:Func _2DArrayAdd(ByRef $avArray, $x, $y, $vValue) If $x > UBound($avArray)-1 Then ReDim $avArray[$x+1][UBound($avArray, 2)] EndIf If $y > UBound($avArray, 2)-1 Then ReDim $avArray[UBound($avArray)][$y+1] EndIf $avArray[$x][$y] = $vValue Return True EndFuncFor varible $x - The Row I use Ubound($VarToSetValue)If you get stuck don't hesitate to ask! Edited September 27, 2010 by DjATUit Link to comment Share on other sites More sharing options...
meisandy Posted September 30, 2010 Share Posted September 30, 2010 Anyone going to give any feed back or is this topic dead? Link to comment Share on other sites More sharing options...
MvGulik Posted September 30, 2010 Share Posted September 30, 2010 Anyone: Who do you have in mind? Feedback: On what? Dead: Depends on OP! "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...
ericnail Posted October 13, 2010 Author Share Posted October 13, 2010 Anyone: Who do you have in mind?Feedback: On what?Dead: Depends on OP!I couldnt figure it out, so i just used multiple arrays. 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