LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving current data to new excel file using write to measurement option

I am relatively new to LabVIEW and I am trying to save data to an excel file. The data is acquired from a sensor and the last data alone is taken for processing. The problem is I need to save only the current data  in to an excel file with an ON/OFF switch. Further, for the next run if I ON the switch a new excel file has to be created and the data saving should stop if the Boolean is switched to off. I am unable to save the data into a new excel file instead it appends to the previous file. Also while saving, I am also not sure whether the data acquired is current data or it is the data in memory.

I am attaching the VI for your reference.

I have just modified the VI  to save in excel using the  'write to measurement' block, the rest is provided  by the vendor.

If someone can help it will be great! 

0 Kudos
Message 1 of 5
(1,517 Views)

Hi Pari,

 


@Pari_s wrote:

I am relatively new to LabVIEW and I am trying to save data to an excel file. The data is acquired from a sensor and the last data alone is taken for processing. The problem is I need to save only the current data  in to an excel file with an ON/OFF switch. Further, for the next run if I ON the switch a new excel file has to be created and the data saving should stop if the Boolean is switched to off. 


This reads like y good description of your task. You "just" need to create a VI to fulfill your requirements!

 

A common problem with "newbies" is the term "Excel file": which kind of file do you want to create? Is a simple spreadsheet file (aka delimited text file aka CSV file) good enough for you? Do you really need a proprietary file format only supported by MSExcel (like XLSX, XLSB, XLSM)?

Recommendation: stick with delimited spreadsheet files as LabVIEW comes with easy-to-use functions for them!

 


@Pari_s wrote:

I am unable to save the data into a new excel file instead it appends to the previous file. Also while saving, I am also not sure whether the data acquired is current data or it is the data in memory.

I am attaching the VI for your reference.

I have just modified the VI  to save in excel using the  'write to measurement' block, the rest is provided  by the vendor.


Unfortunately you forgot to attach your VI, so you need to debug on your own…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,496 Views)

Hello,

 Regarding your first question, any format csv or Tab limited text format is okay. 

I think I attached my file this time correctly.

Thanks for answering my question

   

0 Kudos
Message 3 of 5
(1,461 Views)

Hi Pari,

 


@Pari_s wrote:

 Regarding your first question, any format csv or Tab limited text format is okay. 


You forgot to attach all those missing subVIs and the project file. Next time you better ZIP the whole project folder…

You forgot to cleanup the block diagram! Your code is next to unreadable…

 

  • Why do you use "mouse release" instead of "value change" events?
  • Why are the related boolean terminals not located inside their event cases?
  • Why is there a timeout event case without a timeout value?
  • Why do you need 3 IndexArray nodes to index 3 elements from an array? One IndexArray node is enough!
  • Why do you need 2 ToDDT ExpressVIs to bundle those 3 values into that ugly DDT wire?
  • Why do you use an ExpressVI to write those 3 values into a file?
  • Get rid of all those ExpressVIs and use WriteDelimitedSpreadsheetFile to save your data…
  • Why do you need a ToDDT ExpressVI to show one single scalar value on a chart??? This is just ugly and Rube-Goldberg!

Please cleanup the whole VI and remove(improve atleast the items listed here…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(1,454 Views)

Hello GerdW,

Thanks for answering.

 I am attaching the original version of the files (clean version I suppose) directly from the Vendor. 

The version ending with _demo is the raw file without any modification while the  version ending with _Device_v1  is the one my ex-colleague created.

Please let me know if you need any other file or information.

Thanks

0 Kudos
Message 5 of 5
(1,432 Views)