01-30-2012 04:19 PM - edited 01-30-2012 04:24 PM
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.
Solved! Go to Solution.
01-30-2012 04:38 PM
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.
01-30-2012 04:41 PM
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...
02-01-2012 03:53 PM
Thanks for the help!