Array copy


Closed Thread
Results 1 to 4 of 4

Thread: Array copy

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Array copy

    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 Linquist

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Array copy

    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 Linquist

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Array copy

    Quote Originally Posted by Charles Linquis View Post
    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
    Charles Linquist

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default Re: Array copy

    Are you sure that it need to be constants?

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

    Ioannis

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts