LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Waveform data into CSV file

Hi there, 

 

I have a LV program which contains voltage, current and power data into the same waveform. I am planning to extract each of them one by one and putting into array. Currently, I have extracted only the voltage waveform and converted the data into a CSV file. 

 

However, the problem is that the time stamp (dt) and the y value are in the same cell of the CSV file which requires to post process in excel to get tab delimited format. I would like to get the end result without post processing. 

Can anyone help me to correct the code with delimitor?

Moreover, If I want to add two more data (Current and power), how can I append them into another two columns in the CSV file and synchronize with the relative time (dt)?

Capture.JPG

csv.png

0 Kudos
Message 1 of 5
(773 Views)

Hi hk,

 


@Hk637 wrote:

Moreover, If I want to add two more data (Current and power), how can I append them into another two columns in the CSV file and synchronize with the relative time (dt)?


You just need to add more columns to your array...

 

To find the correct delimiter you could create a CSV file with Excel and read it in a text editor to actually see the used delimiter char. Usually you could use a Tab, comma or semicolon: Excel can handle them all...

 

On your VI: replace the local variable by a wire!

What's the point of wiring a constant to the case structure selector?

Best regards,
GerdW


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

In assumption that your "Value" array contains all three waveforms and you have the same dt and t0 for all of them, then try this way:

csv1.png

 

Side notes:

* "Default" Delimeter for Excel *.csv files is ";"

* Avoid race condition between terminal and local variable (you can't say what will be first — write to terminal or read from variable), so you don't need to wire N terminal if you need to iterate over all input array elemenths:

Screenshot 2024-03-31 12.03.26.png

These two construction semantically equivalent:

Screenshot 2024-03-31 11.57.25.png

* And you don't need parallel for loop in this case

Hope it helps.

Message 3 of 5
(721 Views)

Hi  Andrey

Thanks for the details code and explanation. I modified the code a bit using event structure and from there I am giving the file path. 

 

It worked :).

 

 

 

CSV.png

 

Capture.JPG

  

 



Moreover, I noticed that the power data are not correct (P=VI), when voltage is zero. There is still power which is not true I think. Do you think that the time is not properly synchronized?

 

Thanks in advance. 

0 Kudos
Message 4 of 5
(678 Views)

This is still convoluted and probably wrong. You assume that all waveforms have the same dt (since you only do one time column!), but yet you calculate the same time array N times while only keeping the last one..

 

See if this can give you some ideas

 

altenbach_0-1711913625182.png

 

0 Kudos
Message 5 of 5
(661 Views)