From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

how to write 4 scalar values into an excel file

Solved!
Go to solution

Hello everybody,

 

i'm measuring every second on 4 channels via an 9205. thus i split the dynamic data and translate the measured current into my pressure and temperature values.

now i woul dlike to save my results into an excel file and save and count the duration of measured loop. (an idea how i would like to save it, is in the second picture)

 

could everybody tell me how i can achive that?

 

Thanks a lot,

marc

 

TaskTree.png

WritingData.png

0 Kudos
Message 1 of 7
(3,228 Views)

It is much easier for us to help you (and to test out your code) if you attach code (typically, a VI) instead of a picture (we usually don't have the time to try and recreate your diagram on our PCs).

 

Once you start doing more sophisticated DAQ (like plotting, saving, and processing your points, especially "on the fly"), you should try to "move up" to use DAQmx functions and to stop using the DAQ Assistant.  If you Google "Learn 10 Functions in NI-DAQmx", you will find an excellent White Paper by NI that explains how to do this.

 

You say you want to write values into an Excel file.  Do you mean a file with the extension .xls or .xlsx, Microsoft Excel native file formats, or a "Spreadsheet" file, a text file with a separator character (typically comma or <tab> between fields)?  For Excel, the Report Generation Toolkit (included in the base LabVIEW 2014 and 2015 kits) provide (relatively) easy-to-use functions for doing this, with numerous examples within LabVIEW and on the Web (including this Forum).  To write .csv (Comma-separated Variable) files, you can use NI's "Write Spreadsheet" or "Write Delimited Spreadsheet" (the function changed in LabVIEW 2015) functions.

 

Bob Schor

0 Kudos
Message 2 of 7
(3,213 Views)

Hello Bob,

 

Thank You for your advice, but there is a .zip file with the .vi in the attachment.

I tried a new way in wich, i convertet into a string and write in a .txt file... (pictures and the .vi in the attachment)

 

so my only problem is, that there write every loop in line and not one below the other.

 

Do You know how i can fix it?

 

Thanks

MarcFrontPanel.pngTaskTree.pngResults.png

0 Kudos
Message 3 of 7
(3,178 Views)
Solution
Accepted by topic author MarcTUD

Hi Marc,

 

it would really help if you would also append a NL and/or CR character at the end of each new line. Simplest would be to edit your format string to include that char already…

 

Using autoindexing loops with arrays would simplify your VI so much:

check.png

(Note the special display mode of the format string!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,172 Views)

Hello Gerd,

 

Thanks, I see. It's great!

 

😃

0 Kudos
Message 5 of 7
(3,163 Views)

Hi Marc,

 

I just notice you can simplify my example even more: in the FOR loop you only need to have the Mean function, subtract/divide can be done after the loop due to polymorphism.

Just a minor Rube-Goldberg… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,150 Views)

Hi Marc,

 

 

I got another approach for you:

In case you want to create the Excel sheet manually:  You just need to right click on your chart and press "Export -> Export Data to Excel" after you finished your measurements.

If you want to do that programmatically, you can create an invoke note of the chart and run that invoke note once at the end of your messurement. An idea of mine is to use a case structure between your DAQ-Assistant and your loop condition. In case, you pressed the Stop button you gonna activate the TRUE case of the case-structure and you gonna run the invoke note to create your file.

 

Right now, it seems you are using two charts. If you want to create one table of both charts, you should bundle the inputs of both charts and combine them to one chart.

 

Best regards

Jörg Gunzenhauser

0 Kudos
Message 7 of 7
(3,142 Views)