Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

If I have 4 1 dimensional arrays each declared like:

 

dim Array1(120) as Single

 

Is there a faster way of combining them into 1 2-dimensional array declared:

 

Dim ArrayAll(120,3) as Single

 

other than looping through all 120*4 values?

 

 

:)

Please check the Knowledge Base before you post.

"Computers are useless. They can only give you answers." - Pablo Picasso

The Code Net

Posted
I think you mean Array1(3, 120). A multidemensional array is actaully a matrix, not an array of arrays. If you still want to be able to consider your original arrays as objects after they are combined, what you actually want is a jagged array, i.e. ArrayAll(3)(120). In that case, ArrayAll is a 1-dimensional array with four elements, each of which is an Array. In the first case, ArrayAll is a 2-dimensional array with 484 elements, each of which is a Single. If you decide that the jagged array fits the criteria of what you are doing then you can simply assign each of the existing arrays to the four elements of the jagged array. If the 2-dimensional array is the better fit, you're stuck with copying one element at a time.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...