From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Problem in appending waveform data to a text file

I am trying to write the waveform data to a text file in an appended manner. But it is saving the data in the form of repeated bunches of 1 second, and not continuously. As shown in the attached pic, the data is getting saved at 13:16:38, then 13:16:38 & 13:16:39, then 13:16:38 & 13:16:39 & 13:16:40. How can I save the data in a continuous manner (append) so that it would be like continuous data points at 13:16:38, 13:16:39, 13:16:40, 13:16:41, 13:16:42, 13:16:43 and on. Can anyone help me out?

Download All
0 Kudos
Message 1 of 4
(1,972 Views)

Hi meetrajesh,

 

your VI is doing exactly what you have programmed!

First iteration: your waveform consists of just one sample. You save the waveform.

2nd iteration: your waveform consists of two samples. You append that waveform to the existing file.

3rd iteration: your waveform now consists of 3 samples. You append that waveform to the existing file with 2 waveforms.

Do you get the pattern?

 

When you already built up the waveform in the loop you can do two things:

1. Don't append to the files, but overwrite them.

2. Save the waveform just once AFTER the loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,970 Views)

Earlier I tried by inserting a 'Delete' function after the file path, which overwrites the current data to the file (no appending), but this doesn't solve my case. I want to store the whole data in a continuous manner as I would be needing it in other vi, which reads these data points and plot the waveform.

I can't even do this after the while loop, as it is a PID controller application and continuous monitoring is required. 😞

0 Kudos
Message 3 of 4
(1,934 Views)

Hi meetrajesh,

 

I want to store the whole data in a continuous manner

Deleting the old file and writing a new one (aka overwriting) will do exactly that: write data continuously in the file!

I admit that this is a Rube-Goldberg way of storing the data. so I suggest to save just the new data sample to your file by appending it to the existing file. Then you would need to use other file function as you do now…

 

as I would be needing it in other vi, which reads these data points and plot the waveform.

When you need the data in a different VI running at the same time then you should NOT use files to transfer the data. Use queues, notifier, even shared/global variables…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(1,929 Views)