Hello world.
I am trying to crop X amount of elements from a 2d array. In other words, I have an array with X amount of rows but I want to only keep the first 150. If X < 150 then keep them all of course.
the example below doesnt have +150 records but i was just trying to get the concept going. in the example below I am trying to keep 3 records.
I was thinking of doing it this way but it's not working correctly - simple math i know but i still cant do it
thanks in advance
I am trying to crop X amount of elements from a 2d array. In other words, I have an array with X amount of rows but I want to only keep the first 150. If X < 150 then keep them all of course.
the example below doesnt have +150 records but i was just trying to get the concept going. in the example below I am trying to keep 3 records.
I was thinking of doing it this way but it's not working correctly - simple math i know but i still cant do it
thanks in advance
[ autoit ]
#include <array.au3> $msg_normal = 0 local $array[5] $array[0] = "ABC" $array[1] = "DEF" $array[2] = "GHI" $array[3] = "JKL" $array[4] = "MNO" $number_of_records = UBound($array) $records_to_delete = $number_of_records - 3 debug($array, "BEFORE") For $x = $number_of_records To $records_to_delete Step -1 _ArrayDelete($array, $x) Next debug($array, "AFTER") Func Debug($variable1 = "", $variable2 = "", $variable3 = "") If IsArray($variable1) Then _ArrayDisplay($variable1) Else If $variable2 <> "" Then $variable1 &= @CRLF & $variable2 EndIf If $variable3 <> "" Then $variable1 &= @CRLF & $variable3 EndIf ClipPut($variable1) MsgBox($msg_normal, "Debug", $variable1) EndIf EndFunc ;==>Debug