LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

divide 3D array into 3 1D arrays

hi,

 

Is there a way to split 3D array into three 1D arrays ? 

 

Thank you

 

0 Kudos
Message 1 of 14
(8,797 Views)

Sure -- how do you want to split it?

 

BTW, do you mean a 2-D array that is 3xn or a 3-D array?  If the latter, all you have to do is use the index array fn and get the 3 1-D arrays.  If you really do have a 3-D array, we would need to know how you want to split it.

 

Do you have any code that you are working on that you could upload?

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 14
(8,796 Views)

No, you typically cannot split a general 3D array into 3 1D arrays. (You also cannot take 3 1D arrays and assemble them into a 3D array unless you do some padding.)

 

What you want is only possible for degenerate cases, such as if one of the three dimensions is 1. Of course you could reshape your 3D array into a 1D array with a size of the product of the three dimension and then slice it into three subsets, but that's probably not what you had in mind....

 

Can you give an example for a simple 3D array and what kind of output you expect once you apply the desired algorithm.

Message 3 of 14
(8,785 Views)

hello, thanks for the reply. 

 

I already found the solution first reshaping my 3D array to 2D then I needed the values of the max from this 2D array so I used the max function to get the indexes of the max value ... 

 

my initial idea was just to get those indexes by splitting the 3D to 3 separate arrays .. 

 

 

 

 

 

 

0 Kudos
Message 4 of 14
(8,779 Views)

wrang wrote:

I already found the solution first reshaping my 3D array to 2D then I needed the values of the max from this 2D array so I used the max function to get the indexes of the max value ... 


That still makes not a lot of sense. what are the dimensions? Typically there are many possible 2D arrays and thus outcomes.
Message 5 of 14
(8,771 Views)

from 3D array I need to get a 2D array of 168x9548  and then I'm selecting the max. but now actually I face another problem ... in matlab there is a function mesh which can draw nice 3D graphs but Labview doesn't have smth similar to it ... it is either surface or curve which is not what i want ...

 

How can I draw 3D graph having 2D array or 3D array ?

 

Thank you!

 

 

 

0 Kudos
Message 6 of 14
(8,765 Views)

wrang wrote:

from 3D array I need to get a 2D array of 168x9548  and then I'm selecting the max. but now actually I face another problem ... in matlab there is a function mesh which can draw nice 3D graphs but Labview doesn't have smth similar to it ... it is either surface or curve which is not what i want ...

 

How can I draw 3D graph having 2D array or 3D array ?


You are still giving us very little information. What was the size of the 3D array?

 

The mesh function is the same as a surface 3D graph, you would simply apply a color ramp for the z values and display the surface as a mesh. It's all there!!!

 

What is your LabVIEW version?

 

Why don't you attach a VI that has a typical 3D array as default value in a control or diagram constant.

Message 7 of 14
(8,727 Views)

hello,

 

I'm using Labview 8.5. Attached is a mock-up of what I'm trying to implement ...

 

 
Thank you ! 

 

 

0 Kudos
Message 8 of 14
(8,683 Views)

its a exapmle for 2d and you can adjust it for 3d array too

 

Spoiler
01.PNG
0 Kudos
Message 9 of 14
(6,300 Views)

@NAS2000CO wrote:

its a exapmle for 2d and you can adjust it for 3d array too

 


Please don't post code util you have done some LabVIEW tutorials! Your entire code can be replaced by a single "index array", resized to two outputs and with a 0 wired to the upper column index. See image below.

 

 

 

(...and why are you using spoiler tags to hide the image???)

 

Additional style comments to your original code:

  • Why are you branching the 2D array before the loop? Just to create additional copies in memory?
  • Why are you using two "index array" nodes? One is sufficient You can resize for two outputs. If the indices are 0 and 1, you don't even need to wire the indices if you want the first dimension.
Message 10 of 14
(6,287 Views)