How do I go about searching all columns in one row of a 2d array? For example I want to see if the number 3 is in $array[1], and I only want to search $array[1][0] through $array[1][4].
This is part of the array I am dealing with. It is a large array (9504 elements with 7 sub elements(the last one is currently empty)) that lists all the combinations of the numbers 1 through 12 in a set of five, plus all the combinations of those sets with an extra number between 1 and 12.
[0]|1|2|3|4|5|1|
[1]|1|2|3|4|5|2|
[2]|1|2|3|4|5|3|
[3]|1|2|3|4|5|4|
[4]|1|2|3|4|5|5|
[5]|1|2|3|4|5|6|
[6]|1|2|3|4|5|7|
[7]|1|2|3|4|5|8|
[8]|1|2|3|4|5|9|
[9]|1|2|3|4|5|10|
[10]|1|2|3|4|5|11|
[11]|1|2|3|4|5|12|
[12]|1|2|3|4|6|1|
[13]|1|2|3|4|6|2|
[14]|1|2|3|4|6|3|
[15]|1|2|3|4|6|4|
[16]|1|2|3|4|6|5|
[17]|1|2|3|4|6|6|
[18]|1|2|3|4|6|7|
[19]|1|2|3|4|6|8|
[20]|1|2|3|4|6|9|
[21]|1|2|3|4|6|10|
[22]|1|2|3|4|6|11|
[23]|1|2|3|4|6|12|
I have tried array search but I either get an error code 6 (no match) or it says the array variable has incorrect number of subscripts or something.
I have tried it these two ways: ($complete is the array)
This results in an error about the array variable having incorrect number of subscripts.
This results in error code 6, no match. I assumed this wouldn't work because it seems to imply searching the whole array (but then still it SHOULD find something).
I thought the first one would work, but it doesn't seem to.
While writing this script I have run into the "array variable has incorrect number of subscripts" dozens of times in different places. I havn't used autoit in awhile, I dont remember having to declare the size of an array, or getting this error ever! Has something changed?
Side note: Part of my script requires that I do not know how big the array is going to be, and I need to know exactly how many rows there are when the function is done using the array, and not include any empty rows. How do I do this? ReDim every time? What if I need to redim 100 million times (likely)? There has got to be a better way.
This is part of the array I am dealing with. It is a large array (9504 elements with 7 sub elements(the last one is currently empty)) that lists all the combinations of the numbers 1 through 12 in a set of five, plus all the combinations of those sets with an extra number between 1 and 12.
[0]|1|2|3|4|5|1|
[1]|1|2|3|4|5|2|
[2]|1|2|3|4|5|3|
[3]|1|2|3|4|5|4|
[4]|1|2|3|4|5|5|
[5]|1|2|3|4|5|6|
[6]|1|2|3|4|5|7|
[7]|1|2|3|4|5|8|
[8]|1|2|3|4|5|9|
[9]|1|2|3|4|5|10|
[10]|1|2|3|4|5|11|
[11]|1|2|3|4|5|12|
[12]|1|2|3|4|6|1|
[13]|1|2|3|4|6|2|
[14]|1|2|3|4|6|3|
[15]|1|2|3|4|6|4|
[16]|1|2|3|4|6|5|
[17]|1|2|3|4|6|6|
[18]|1|2|3|4|6|7|
[19]|1|2|3|4|6|8|
[20]|1|2|3|4|6|9|
[21]|1|2|3|4|6|10|
[22]|1|2|3|4|6|11|
[23]|1|2|3|4|6|12|
I have tried array search but I either get an error code 6 (no match) or it says the array variable has incorrect number of subscripts or something.
I have tried it these two ways: ($complete is the array)
[ autoit ]
$value = 6 $result = _ArraySearch($complete[1], $value, 0, 4) $err = @error ConsoleWrite($result&" --- "&$err)
[ autoit ]
$value = 6 $result = _ArraySearch($complete, $value, 0, 4) $err = @error ConsoleWrite($result&" --- "&$err)
I thought the first one would work, but it doesn't seem to.
While writing this script I have run into the "array variable has incorrect number of subscripts" dozens of times in different places. I havn't used autoit in awhile, I dont remember having to declare the size of an array, or getting this error ever! Has something changed?
Side note: Part of my script requires that I do not know how big the array is going to be, and I need to know exactly how many rows there are when the function is done using the array, and not include any empty rows. How do I do this? ReDim every time? What if I need to redim 100 million times (likely)? There has got to be a better way.