erezlevi Posted January 21, 2008 Share Posted January 21, 2008 hi, why can't I get the second dimension values inside $r? #include <Array.au3> Dim $a[10][20] = [[1,2,3,4,5,6,7,8,9,0],[11,12,13,14,15,16,17,18,19,20]] for $i=1 to 10 $r=$a[][$i] MsgBox (0,"this is $r",$r) Next Link to comment Share on other sites More sharing options...
martin Posted January 21, 2008 Share Posted January 21, 2008 hi, why can't I get the second dimension values inside $r? #include <Array.au3> Dim $a[10][20] = [[1,2,3,4,5,6,7,8,9,0],[11,12,13,14,15,16,17,18,19,20]] for $i=1 to 10 $r=$a[][$i] MsgBox (0,"this is $r",$r) Next A nice mess you've got there erezlevi! You have declared $a to be a 10 x 20 array then given it values that are 2 x 10. You have no index for the first element for $a inside the for/next loop. You are going from 1 to 10 but yu need to go from 0 to 9. Try this #include <Array.au3> Dim $a[2][10] = [[1,2,3,4,5,6,7,8,9,0],[11,12,13,14,15,16,17,18,19,20]] $J= 1 for $i=0 to 9 $r=$a[$J][$i] MsgBox (0,"this is $r",$r) Next Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Valuater Posted January 21, 2008 Share Posted January 21, 2008 (edited) Dim $a[2][10] = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]] For $i = 0 To 1 For $ii = 0 To 9 $r = $a[$i][$ii] MsgBox(0, "this is $r", $r, 1) Next Next ....... tooooo slow!!! 8) Edited January 21, 2008 by Valuater Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 21, 2008 Share Posted January 21, 2008 A nice mess you've got there erezlevi! You have declared $a to be a 10 x 20 array then given it values that are 2 x 10. You have no index for the first element for $a inside the for/next loop. You are going from 1 to 10 but yu need to go from 0 to 9. Try this #include <Array.au3> Dim $a[2][10] = [[1,2,3,4,5,6,7,8,9,0],[11,12,13,14,15,16,17,18,19,20]] $J= 1 for $i=0 to 9 $r=$a[$J][$i] MsgBox (0,"this is $r",$r) Next Lol was $J = 1 really necessary lol? Link to comment Share on other sites More sharing options...
herewasplato Posted January 21, 2008 Share Posted January 21, 2008 (edited) Dim $a[2][20] = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]] For $i = 0 To 9 $r = $a[0][$i] MsgBox(0, "this is $r", $r) Next For $i = 0 To 9 $r = $a[1][$i] MsgBox(0, "this is $r", $r) NextVal [edit: & others] beat me to it - but here is another way to look at it... Edited January 21, 2008 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
martin Posted January 21, 2008 Share Posted January 21, 2008 Lol was $J = 1 really necessary lol?It's surprising how few things in the world are really necessary. I was just too lazy to do what Valuater and herewasplato did . Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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