LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting arrays into more arrays

Solved!
Go to solution

Hi everyone,

 

I could not find a similar enough problem on the forum, hency my new post. I have a number of arrays that need splitting.

 

Say I have data stored in 4 arrays (or columns), named IGS, VGS, IDS, VDS. These four columns have each n * 80 cells, where n corresponds to the number of measurements. What I would like to do is to have n number of times IGS, VGS, IDS and VDS, where each array is only 80 cells long. So when viewed in e.g. Excel, the first row would look like:

 

IGS VGS IDS VDS IGS VGS IDS VDS IGS VGS .......

 

 

Many thanks for helping.

0 Kudos
Message 1 of 7
(3,073 Views)

If you have a 4 column 80 row array and then want 4 1-D arrays of each of those columns, you just need the Index Array function.

 

If this isn't what you want, attach a VI that has some real data as it is now and an example of what you want.

 

If it is what you are looking for, then it is basic LabVIEW and I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 2 of 7
(3,066 Views)

Hi, as mentioned, I have 4 arrays, each n * 80 cells long. What I am looking for is n * 4 arrays, each 80 cells long. Many thanks for replying.

0 Kudos
Message 3 of 7
(3,062 Views)

That description was not clear in your original message.  Without example data, it is difficult to play with and come up with what you want.

 

You may want to just loop through things, auto-indexing on the 4 arrays simultaneously.  Maybe you want to use Build Array and concatenate the  arrays together to so you have 4xn columsn with 80 rows.  Then autoindex on that to get your 4xn arrays.

0 Kudos
Message 4 of 7
(3,058 Views)
Solution
Accepted by topic author PiotrW

You can start by finding the size of you individual arrays, IGS, VGS, IDS, and VDS.  I assume they would be the same size.  Divide size by 80 and that is the index for your main for loop.  Use the array subset VI and pull 80 element chunks out of each array.  Once you have the 80 element chucks you can set up another loop on the arrays and build the longer 1D array with a build Array function with a concatenate input feature.  Use shift registers and another build array function to add the next row to the main array.

 

I believe this is what you wanted.

Message 5 of 7
(3,040 Views)

Thank you very much Joe, I implemented most of your suggestions and it worked perfectly fine. See below for a screenshot.

0 Kudos
Message 6 of 7
(3,001 Views)

You can cut and rebuild by transposing and concatenating. (The shift register can be a Concatenating output in newer LV's)

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(2,916 Views)