03-01-2019 06:11 AM
Hi,
Ive asked a similar question before but now I understand the parameters a bit better.
My array writes to a waveform chart and at the end exports the graph to excel. However, i need it to continuously write the data to an excel file for the safety of the data. Is write to delimited spreadsheet the correct thing to use?
Thanks
Solved! Go to Solution.
03-01-2019 07:15 AM
Hello, Newman,
you can use the write to delimited spreadsheet.vi with the append to file? input set to true. This will not give you a 'real' excel file, but only a tabular text file that excel can read and convert. None of the formatting options of excel are available here.
Depending on how big your data set is, you might want to consider storing it in a binary format (e.g. tdms) and generate an excel report at the end. Your suggestion will do what you asked for, though.
03-01-2019 07:32 AM
A couple of points.
Now that I've gotten that out of the way, your question comes down to wanting to save data "as it is acquired". There are plenty of discussions of how to save data being acquired that involve such questions as "how fast are the data arriving", "how many channels of data", "are all of the data numeric?", "how much precision do you need", "do you need any meta-data, such as sampling rates, time of day, operator name, etc".
Continuous data acquisition usually involves opening the output file first, and doing the "continuous acquisition and storage" in one or more While Loops, with the file reference wire held in a Shift Register. In many cases where time is critical (i.e. high data rates), a Producer/Consumer design lets data saving happen pseudo-simultaneously with data acquisition.
I looked at your VI. You seem to be using proprietary third-party acquisition code. I recommend you take a look at some LabVIEW DAQmx examples to see how DAQ code should be written. Usually Acquisition Functions are "self-clocking" -- you say "Acquire 1000 samples at 1 kHz", put this in a loop, and that loop will run exactly at 1 Hz (as it takes 1000 * (1/1000) seconds to do the acquisition). It is (almost always) a mistake to put any other timing function in a DAQ loop.
Bob Schor
03-01-2019 09:15 AM - edited 03-01-2019 09:20 AM
Thanks that worked but the delimiter doesnt seem to work? tried a few combinations of (\t)
03-01-2019 09:45 AM
Have you tried terminal's default value? You can try creating the default value constant via right-click menu(Create >> Constant). Then you'll see '\t' under the string's code display mode.
-Tianbin
03-04-2019 03:33 AM
Hi, Ive tried that but now i just get this instead? the file is a csv if that makes any difference
Thanks
03-04-2019 03:55 AM
Exactly, the .csv file is the difference. For .csv file, you should just use comma(',') instead of '\t' as delimiter. I tried that the '\t' delimiter works well for .xlsx and .xls file formats.
Regards,
Tianbin
03-04-2019 04:06 AM
Yeah that was pretty stupid, wasnt aware you could do xls files.
Thanks for your help
03-04-2019 08:23 AM
@newman3108 wrote:
Yeah that was pretty stupid, wasnt aware you could do xls files.
I'm not sure what you mean by "could do xls files". Write Delimited Spreadsheet (formerly named, I think, "Write Spreadsheet File") writes a plain Text File, using a character (LabVIEW default is <tab>) between entries of a 1D Array, and for 2D arrays, writes each row as a line of text, separating rows with <CR><LF>. This particular format of text files, useful to display tabular numeric data, is (particularly when a comma is used as a delimiter) called a "Comma-Separated Values" (or .CSV) file.
Microsoft's Excel program can read text files of this format, and, indeed, has created an "Excel-like" Icon for files with the .csv extension (which fools people into thinking these are "Excel Files"). Microsoft can, indeed, read these and bring them into Excel, where they can be manipulated, but if you try to save them, you'll get a warning that "certain features" won't be saved in the (ordinary) Text file, and are invited to save the file in Excel's proprietary .xlsx format.
If you read the Help for Write Delimited Spreadsheet, you'll see a disclaimer that this is, indeed, a pure Text file, and if you want to use Excel's "native" file format, you need to use ActiveX or the Report Generation Toolkit. The Help also notes that LabVIEW uses the <tab> as the default separator, not the comma.
Bob Schor
03-06-2019 09:15 AM
I have a similar problem on LabVIEW NXG.
I'm trying to write data in a .csv file in a slow (1s) loop so that one line is written at each iteration
I use the "write in a spreadsheet file" node with "append to file" checked
For some reason, only the last value is présent in the file