Issues start to appear when I enter "NumberOfElements" parameter greater than the difference between source index and dest. index.
Copies a specified number of elements from the specified one-dimensional source array, starting at the specified source index; the elements are copied to the specified one-dimensional destination array, starting at the specified destination index.
Source and destination can be the same array as well as two different arrays.
Usage
Array_Copy(SourceArray,SourceIndex,DestinationArray,DestinationIndex,NumberOfElements)
Where: SourceArray - an expression specifying the name of the source array
DestinationArray - an expression specifying the name of the destination array
SourceIndex - a numerical expression specifying the starting index for the source array
DestinationIndex - a numerical expression specifying the starting index for the destination array
NumberOfElements - a numerical expression specifying the number of elements to copy
Example
Copy from Array1 the two-element segment beginning at the index of 4, to the Array2, beginning at the index of 6:
Array_Copy(Array1,4,Array2,6,2);
Copy from Array1 the two-element segment beginning at the index of 4, to the same array, beginning at the index of 6:
Array_Copy(Array1,4,Array1,6,2);
Code: Select all
var:timewindow(false);
timewindow = d=1240119 and time >= 800 and t <= 1000;
array:
int arrOne[10](0);
once (true) begin
array_setintegervalue(arrOne,1,1);
array_setintegervalue(arrOne,2,2);
array_setintegervalue(arrOne,3,3);
array_setintegervalue(arrOne,4,4);
array_setintegervalue(arrOne,5,5);
array_setintegervalue(arrOne,6,6);
end;
//Code-->
if timewindow and value10>0 //skip first round
then begin
array_copy(arrOne,1,arrOne,2,3);
print (
t," COPY 1:",
array_getintegervalue(arrOne,1), " 2:",array_getintegervalue(arrOne,2)," 3:",array_getintegervalue(arrOne,3)
," 4:",array_getintegervalue(arrOne,4)," 5:",array_getintegervalue(arrOne,5)," 6:",array_getintegervalue(arrOne,6)
);
end;
if timewindow
then begin
value10+=1; //Counter
array_setintegervalue(arrOne,1,value10);
print( t," new val: ", array_getintegervalue(arrOne,1) );
end;
//<--
//Log
if timewindow
then begin
print (
t," 1:",
array_getintegervalue(arrOne,1), " 2:",array_getintegervalue(arrOne,2)," 3:",array_getintegervalue(arrOne,3),
" 4:",array_getintegervalue(arrOne,4)," 5:",array_getintegervalue(arrOne,5)," 6:",array_getintegervalue(arrOne,6)
);
end;