PDA

View Full Version : Array copy



Charles Linquis
- 5th July 2011, 22:00
I know I can fill an array using the ArrayRead command,

ArrayRead,TestArray,["0","1","2","3","4"]

But is there a way I can copy part of an array into another using this command?

If I wanted to copy SourceArray elements 4-13 into DestinationArray the following
construct would be nice.

ArrayRead DestinationArray,[Skip4 SourceArray \10]

But this doesn't work. Is there some way other than a FOR - NEXT loop to
perform this operation quickly?

Charles Linquis
- 5th July 2011, 22:45
I figured it out.


ArrayRead DestinationArray[2],[STR SourceArray [4] \10]

Starts with the 4th element of SourceArray and loads 10 elements into the DestinationArray starting at element 2

Charles Linquis
- 6th July 2011, 02:45
I figured it out.


ArrayRead DestinationArray[2],[STR SourceArray [4] \10]

Starts with the 4th element of SourceArray and loads 10 elements into the DestinationArray starting at element 2


BUT - I find that the array element designators (2 & 4 in this case) must be constants

Ioannis
- 6th July 2011, 10:32
Are you sure that it need to be constants?

If yes, all the joy is lost now... :(

Ioannis