Results 1 to 5 of 5

Thread: Copy Part of an Array [Resolved]

  1. #1

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166

    Copy Part of an Array [Resolved]

    How would I copy part of a four dimmensional array to a one d array. I only want part of it. For example in vb I would say

    Code:
    for i = 1 to 25
       my1darray(i) = my4darray(i,12,12,12)
    
    next i
    The array will not always be 25 though. It has to be flexible. Thanks.
    Last edited by jordan23; Jul 22nd, 2004 at 05:16 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Umm , so how many elements do you want to copy and from which dimension number you want to start copying ??

  3. #3

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166
    Well, the number of elements will vary but lets say 25. It will go with the first index. So it would be myArray(1-25,11,11,4) like that. Does that make sense?

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    This will add the values from the first element of the first dimension of my4darray to my1darray .
    PHP Code:
    for(int i=;i<= my1darray.GetUpperBound(0);i++)
    {
       
    my1darray[i] = my4darray(i,12,12,12);

    I didn't test the code (hope no errors... )but i assumed arrays declaration were done right .

  5. #5

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166
    Thanks Pirate!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width