From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two silly questions - file header and saving time

Solved!
Go to solution

1. How can I add a header in write spreadsheet file.vi? (At the moment, it only stores a number of columes of data with each colume representing one channel. I want to put a header at the top indicating the names of the channels).
2. Can I store the date and time, at which each point of data is logged, together with the data themselves in one file?

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

You can open the "Write To Spreadsheet File.vi", modify it with a header input that works to your liking, and save it as another name (don't overwrite the original).  Adding another Array to Spreadsheet String VI, a string concatination, and an array of strings input for your headers is all that is needed.

 

As for saving the actual time for each data point you would need to track that with your data and add it along with the rest of your 2d data.  The Write To Spreadsheet File.vi doesn't have this feature built in.

 

Alternatively, I recommend you do the following:

 

1. Be sure to use the Waveform output on any kind of data read operation if it is available.  Familiarize yourself with this complex data type that NI has come up with as it will really save you a lot of headaches and extra coding.  If the VI that is doing your data reading does not support the Waveform data type, then you can always convert the data to a waveform.

2. Try using the Write Measurement File Express VI.  You will probably have more luck with that then the write to spreadsheet vi.

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

Do you have there Report Generation toolkit?  If so, there are Excel specific functions for modifying the spreadsheet.  Attached is a VI that may help. 

Yes, to number two.  Store the data/time in your 2D array along with your data, preferably on the same row.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 3 of 4
(2,270 Views)

nothing wrong with format into file.  works just like scan into string.  When you create your file just write a single line for the header information.

 

What format is your "spreadsheet" in? and what to you open it with to view?  this is a handy vi to re-format a LabVIEW timestamp into a date/time format used by Excel and Lotus.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 4
(2,246 Views)