LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Customize headers using Write to Measurement File

Hello

 

I am attempting to customize the headers in the write to measurement file.  I have 17 different categories of data I need to save to the same measurement file.  I have looked at a few examples such as the one I have listed below:

 

https://decibel.ni.com/content/docs/DOC-10694

 

But I would have to repeat that process 17 times!  As well, I tried to implement it into another portion of my program where I only need to save 4 sets of data from my four instruments and the file ended up like the one I have attached below labeled "work off 4.lvm" .  In my state machine, the 0 and 1 cases are the two cases where I save data.  The 0 case is where only the data from 4 sensors is saved and within the 1 case, that is were 17 categories of data are saved as a result of the analysis performed on the data obtained from the instruments.  

 

Is there a more efficient way to accomplish this?  As well as fix the output file so that when the user wants to obtain more data all of the data is added to their respective columns but also added to the next row. 

 

Thanks for the help!

Ellen

Download All
0 Kudos
Message 1 of 2
(2,698 Views)

The easiest way to get the channel names is to do it in a FOR loop.  Create a constant array of your signal names, then run this and the signals into a FOR loop.  Use the indexed signal name for your input Signal Name and the FOR loop index for the Signal Index.

 

Headers are added each time you write data because the header includes the number of points in each column.  However, you don't need to use the Write To Measurment File VI to write your data.  To append to the end of the current file (with the knowledge that your header will be wrong), you can do the following:

 

  1. Use the Write To Measurement File to generate your first set of data (use a case structure around it to select this case the first iteration)
  2. After writing the first iteration, use the filename output to open the file as a text file and store the file reference in a shift register in the main loop.
  3. On subsequent iterations, use the Array to Spreadsheet String primitive to convert your data to a line of text and write to the file using Write To Text File.
  4. Close the file after the loop finishes.

At this point it may easier to open the file and add your own header info (including column headers) before the loop starts, add data to the file in the loop, and close afterwards.

 

Let us know if you need further help or hints.

0 Kudos
Message 2 of 2
(2,666 Views)