LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rearranging array data

Solved!
Go to solution

This has probably been asked and answered before, but I can't seem to find it anywhere.

 

I am saving a bunch of data to an lvm file in the form of a 1D array. When I open the spreadsheet the data appears in this format

 

0 2.525174
1 0.390727
2 4.00143
3 0.020132
0 2.525174
1 0.390727
2 4.00143
3 0.020132
0 2.525174
1 0.390727
2 4.00143
3 0.020132
0 2.525174
1 0.390727
2 4.00143
3

0.020132

 

0-3 are my four analog channels. I want the data to look like this when I open the files in excel:

0 2.525174 2.525174 2.525174 2.525174
1 0.390727 0.390727 0.390727 0.390727
2 4.00143 4.00143 4.00143 4.00143
3 0.020132 0.020132 0.020132 0.020132

This way I can easily see which data points belong to which channel.

 

Alternatively, this way would be even better:

0 1 2 3
2.525174 0.390727 4.00143 0.020132
2.525174 0.390727 4.00143 0.020132
2.525174 0.390727 4.00143 0.020132
2.525174 0.390727 4.00143 0.020132

 

I'm pretty new to LV and can't seem to find a way to re-format the data before it goes to my 'write.vi'.

I'm attaching my vi just in case that helps in any way.

Thanks in advance!

 

 EDIT: accidentally attached the wrong file. This is the correct one.

0 Kudos
Message 1 of 4
(2,333 Views)
Solution
Accepted by topic author carfreak4671

Hi.

 

You can use the Decimate array function with 4 outputs to automatically build an individual array for each channel, you can then use Build Array to merge all channels as a single 2D array (Which would look like the second array you posted). Finally you can transpose the array to format it as in your third example. Hope it helps!

 

Best Regards.

 

Aldo H
Ingenieria de Aplicaciones
0 Kudos
Message 2 of 4
(2,322 Views)

Check-out the Reshape Array function and work on only the 2nd column of data - for what you are doing the 1st column is really redundant anyway. Once you have converted this 1D array into a 2D array, Transpose 2D Array will swap the rows and columns.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 4
(2,319 Views)

Thanks for the help!

0 Kudos
Message 4 of 4
(2,282 Views)