LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving data as a spreadsheet

Basically when my program is run, i want to save my results as a spreadsheet file. There is roughly 5+ channels of data e.g. voltage, temperature etc. And these come out of field point read vi's. At the moment all the data is split up into elements and put into a build array. But most of the save as spreadsheet examples i have requre a 2D array input.

Is there any other way of approaching this, also when my data is saved as a spreadsheet i need to be able to add headers to the columns of data.
0 Kudos
Message 1 of 8
(3,545 Views)
Take a look inside the "Write to spreadsheet file.vi".

First it will accept 1-d or 2-d arrays as input.

It also illustrates that the data is converted to a string before writing. I point this out because that is what your headers end up being.

Does this get you anywhere?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 8
(3,545 Views)
Thanks mate, works a treat. Just got stuck with another problem, if u can help. Got my data and headers ont the spreadsheet but because iam using a while loop to sychronise the data, the headers are repeating themselves e.g. line of headers-line of data etc. Just wondering if its possible to get the headers to write once without removing the while loop.

Thanks Stuart
0 Kudos
Message 3 of 8
(3,545 Views)
The data header needs to be written outside the while loop. I'll recommend you take another approach with four vi's namely Open/Create/Replace File.vi, Array to spreadsheet String.vi, Write File.vi, and Close File.vi. Open your file, format your header to spreadsheet string and write it into your file once before data acquisition. Have your header file as array constant of strings in your diagram. Inside your loop all you need to do is to format your data to spreadsheet string and write them to your file when ever your want. After you are done with data gathering then close the file. Write to Spreadsheet File.vi is pretty straight forward but I think lacks the flexibility you want. Check LabVIEW File I/O examples under HELP as well.
0 Kudos
Message 4 of 8
(3,545 Views)
Find attached a sample vi (LabVIEW 6i)
Message 5 of 8
(3,545 Views)
Thanks, works a treat.

Stuart
0 Kudos
Message 6 of 8
(3,545 Views)
Stu,

If you wire the 1D array into the Build Array, the out put will be a
2D array shaped just like the original. That should fix you up.

Mike

stu22 wrote in message news:<506500000008000000BF540000-1027480788000@exchange.ni.com>...
> Basically when my program is run, i want to save my results as a
> spreadsheet file. There is roughly 5+ channels of data e.g. voltage,
> temperature etc. And these come out of field point read vi's. At the
> moment all the data is split up into elements and put into a build
> array. But most of the save as spreadsheet examples i have requre a 2D
> array input.
>
> Is there any other way of approaching this, also when my data is saved
> as a spreadsheet i need to be able to add headers to the colu
mns of
> data.
0 Kudos
Message 7 of 8
(3,545 Views)
stu22:

Assuming you get 1 element at a time for each of 5 sensors, humidity,
temperature, etc.

What you really are trying to do is create a data logger for a
continuous process as it is happening right?

The write spreadsheet vi is really intended for a post-process data
dump. If you intend to write your data post process, it should be
possible to accumulate all your sensor data into 1D arrays, tack a
header onto each and then combine them into a single 2D array for
writing.

If you want to do it during the process, you could write to Excel
using ActiveX.

You could also log the data to a database using SQLToolkit. I've done
this with a temperature/humidity monitoring system before.

It sounds like the update speeds here will be relatively low, say
1/seco
nd. If this is wrong then let us know more about your system.

Douglas De Clue
LabVIEW programmer
ddeclue@bellsouth.net




stu22 wrote in message news:<506500000008000000BF540000-1027480788000@exchange.ni.com>...
> Basically when my program is run, i want to save my results as a
> spreadsheet file. There is roughly 5+ channels of data e.g. voltage,
> temperature etc. And these come out of field point read vi's. At the
> moment all the data is split up into elements and put into a build
> array. But most of the save as spreadsheet examples i have requre a 2D
> array input.
>
> Is there any other way of approaching this, also when my data is saved
> as a spreadsheet i need to be able to add headers to the columns of
> data.
0 Kudos
Message 8 of 8
(3,545 Views)