AcidCorps Posted October 19, 2007 Share Posted October 19, 2007 (edited) I'm trying to get the hang of Multi-Dimension arrays but not having much luck I have 3 Arrays which I'd like to combine into a single Multi-Dimension array, they all contain the same amount of elements if that makes a difference Edited October 19, 2007 by AcidCorps Link to comment Share on other sites More sharing options...
Paulie Posted October 19, 2007 Share Posted October 19, 2007 (edited) I'm trying to get the hang of Multi-Dimension arrays but not having much luck I have 3 Arrays which I'd like to combine into a single Multi-Dimension array, they all contain the same amount of elements if that makes a difference#Include <Array.au3> Dim $Array0[3], $Array1[3], $Array2[3] ;Value = array.element ;Array0 $Array0[0] = "0.0" $Array0[1] = "0.1" $Array0[2] = "0.2" ;Array1 $Array1[0] = "1.0" $Array1[1] = "1.1" $Array1[2] = "1.2" ;Array2 $Array2[0] = "2.0" $Array2[1] = "2.1" $Array2[2] = "2.2" Dim $Combo [3][3] For $y = 0 to 2 $Combo[0][$y] = $Array0[$y] Next For $y = 0 to 2 $Combo[1][$y] = $Array1[$y] Next For $y = 0 to 2 $Combo[2][$y] = $Array2[$y] Next _ArrayDisplay($Combo, "Combined Arrays") Just one example. Edited October 19, 2007 by Paulie Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 19, 2007 Share Posted October 19, 2007 (edited) I'm trying to get the hang of Multi-Dimension arrays but not having much luckI have 3 Arrays which I'd like to combine into a single Multi-Dimension array, they all contain the same amount of elements if that makes a differencePaulie's example works fine, and they don't have to be the same number of elements. You could just use Ubound() to find the longest one and use that for your new array's number of rows. Depending on how much logic you want to code into it, you could put together arrays with different numbers of dimensions too, because Ubound($avArray, 0) can be used to determine the number of subscripts (dimensions) and adjust the output accordingly.If you're going to do a lot of this, it would be better to code a generic function to append the scripts together. Edited October 19, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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