LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D array to 3 different 1D arrays

Solved!
Go to solution

Good morning.  I'm new to this so please have mercy.

 

I have a matrix (n×3) and I need to separate every column with each rows into 3 different 1D arrays.

 

Thank you

 

 

 

0 Kudos
Message 1 of 5
(1,919 Views)

Nx3 actually sounds like.a 2 dimensional array with N rows and 3 columns.

 

You can wire that array into "Index Array" and expand it to 3 outputs and "Slice" the 2D array by rows or columns.  Read the detailed help on index array to learn more.

 

If you really do have a 3D array you should post some code with default data in the array and an example of what the output should be. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 5
(1,894 Views)

This may be a "language" thing, but I think of an "n X 3 matrix" as a 2D arrangement of numbers having n rows and 3 columns that has certain mathematical operations (like "matrix multiplication") defined on it.  Note that LabVIEW has an "Array" data type that can be of any (but rarely more than 3) dimension, and the LabVIEW Matrix was introduced more recently (a few versions ago, don't remember quite when).

 

Look at the functions in the Array palette, read their Help description, and you should be able to figure this out.

 

Bob Schor 

0 Kudos
Message 3 of 5
(1,872 Views)

@Flechery0202 wrote:

Good morning.  I'm new to this so please have mercy.

 

I have a matrix (n×3) and I need to separate every column with each rows into 3 different 1D arrays.


Index Array with the 1st Column number wires (the others will auto-index)

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(1,864 Views)
Solution
Accepted by topic author Flechery0202

You have a 2D array, not a 3D array.

 

In LabVIEW, a "matrix" is a very special 2D array exclusively for linear algebra, so don't use that word unless it applies to your case.

 

Array operations are fundamental to efficient code and they are handled very elegantly in LabVIEW. You should really do some of the basic tutorials.

 

If you wire both indices of index array, you get a scalar element. If you wire only one index you get a row or column of a 2D array, depending on which you wire. If you want the first row, you don't need to wire any index! If you resize "index array", corresponding indices increment automatically with each output and don't need to be wired. (Similarly, if you wire only one index for a 3D array, you get one plane, etc.).

 

Here's a quick demo:

 

altenbach_0-1671728037442.png

 

0 Kudos
Message 5 of 5
(1,854 Views)