LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving continuous measurements in Excel

So, I'm trying to integrate a function into my program, that is used to take measurements of resistors that exceed a maximum voltage.

I want to have the program save the data in a .csv file while it's running, formatted in a specific way.

The problem right now is, that the program only saves the last recorded bunch of data (index of resistor, time of measurement and the measurement itself, as well as I don't know how to go about formatting the data in the way I would like it to look.

Also, it gives me all of this data in one line each: so one line for indexes, one for all of the times and one for all the measurements.

 

I'll provide examples of how it looks right now in the .csv and my program and how I would like for it to look in the attachments.

 

Any help will be  greatly appreciated 🙂

Download All
0 Kudos
Message 1 of 3
(677 Views)

You can try similar like this (Single Timestamp for Complete dataset) and you will get the results as attached

 

PalanivelThiruvenkadam_2-1691667290352.png

 

 

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 2 of 3
(625 Views)

Here are some comments that I hope will help you "do this correctly".

  • You are not saving measurements in "Excel".  Microsoft Excel has nothing to do with what you want to do.  [Neither does "Visicalc", which predated Excel].  You want to create a "formatted Text file consisting of (largely) numeric data arranged in an Array, with some characters (common ones are <tab> and comma separating the columns, and the rows written as "rows of text", i.e. separated with <CR><LF>.
  • LabVIEW (correctly) calls this a "Spreadsheet File", where "rows" represent separate entries, and "columns" often "separating" different aspects of each entry (for example, the time of the sample, the Voltage measured, etc.)
  • LabVIEW's "Spreadsheet" files (especially the "Write Delimited Spreadsheet") are designed to be used repeatedly to write a single file.  You always add "complete rows", but you can write them "one row at a time" or "a whole mess of data from hundreds of measurements" (a 2D Array of numerics, probably) with a single function.
  • If what you want to do is write something that "looks like" an Excel Worksheet, with Text labels on the first row that "names" the data that will appear in the subsequent rows.
    • For the first row, make an Array of Strings that you want for each Column header.  If you have a column that doesn't get a header, enter a blank String into the Array.
    • When you need to put in data, arrange your data as a 1D Array (for a single row) or a 2D Array (for however many rows of data you have).  Note that because you are saving with an Array, the data have to all be the same time, typically all Integers, Dbls, or Strings.
    • You do not need to close the file. It is automatically closed after every "Write Delimited Spreadsheet" (which lets you write as the data is gathered, so if you have 1000 records, you don't need to hold them all in memory, but can save them as you collect them).

If you open LabVIEW Help and look at the Detailed Help for Write Delimited Spreadsheet, it will explain how it works (similarly to what I've done here).  It will also point you to some Example Code that ships with LabVIEW, and illustrates how to use these functions.

 

Bob Schor

 

0 Kudos
Message 3 of 3
(584 Views)