LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying timestamped data on a graph

Can anybody tell me how can I read and display the timestamped data on to a waveform graph from a text file (attached)?

0 Kudos
Message 1 of 17
(2,924 Views)

Hi meetrajesh,

 

your file is formatted in a very cumbersome way. You really should clean up the file generation part to use just one delimiter char and no empty lines!

check.png

Just a suggestion. There are other options (including using ReadDelimitedFile in string mode).

Hint: note the display mode of those string constants and indicators!

Best regards,
GerdW


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

As shown in the attached VI, the timestamped data is getting saved through the for loop and I guess some way should be there to format the data here itself so that it would not add any empty line in between. Can you pls help me out with saving this timestamped data in a proper format to a text file and display the data on a graph by referring this text file.

0 Kudos
Message 3 of 17
(2,895 Views)

Hi meetrajesh,

 

create your own VI to save the data to a properly formatted file!

 

- Those extra empty lines are added due to "no header" and "appending" settings of waveform export function.

- Timestamp formatting also is internal to that waveform function.

Best regards,
GerdW


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

Kudos for this useful info. Actually I am new to Labview and have never worked with tdms files. Although I implemented your concept of putting a for loop in my previous attempt, and now it is successfully saving only the current data. You can refer the attachments. The concern is, it is inserting empty lines in between two samples (I am not sure if it would create any problem). 

Now eventually can you pls tell me how can I read and display this timestamped data (saved in .txt file) on to a waveform graph? It will solve my whole issue and I would be very thankful to you. 🙂

Download All
0 Kudos
Message 5 of 17
(2,874 Views)

Thanks for your valuable guidance. I tried to format the timestamped data file but it is not showing the expected results (its showing an error too) and I am not sure whether it would process only the first sample or all of them. And I guess in your screenshot I will have to feed timestamp, ch0 and ch1 to a waveform graph for a proper display.

 

Can you plz tell me if I can display the data directly without formatting the file, using Read Delimited File in string mode? I have been stuck here since last one week, I would be very thankful to you if you can sort out my problem. 😞

Download All
0 Kudos
Message 6 of 17
(2,849 Views)

Can anybody tell me how can I read and display the attached text file on to a waveform graph using Read Delimited Spreadsheet function? Or is there any alternate way to do this? I want to display these 2 samples with their timestamp on the X-axis.

0 Kudos
Message 7 of 17
(2,834 Views)

Why does your text file have extra line breaks in it.  It would be best if you could clean up the program that created this file so it didn't do that.

 

Otherwise, you can use the Read Text file functions to read it in a line at a time and discard every other line.  Keep the first and use scan from string to get the date/time time, and two data values.  The times looks like they repeat,, your first 8 rows are 2-18-2019 17:06:00.259742  so a waveform graph isn't a good option.  Waveform graphs expect equally spaced data.

 

You may want to use an X,Y graph.

0 Kudos
Message 8 of 17
(2,825 Views)

I am trying to reformat the text file using 'Spreadsheet string to array' and 'Scan from string' functions but it is showing the following error:

 

"Error 1 occurred at Scan From String (arg 1) in format_data.vi"

 

Hence it is not generating timestamps and the two data values. Once I get these values then I can plot these on a graph.

0 Kudos
Message 9 of 17
(2,815 Views)

Here is a snippet that might help you out. I'm plotting on an X-Y graph, though you know better how you want to display it.

VISnippet.png

0 Kudos
Message 10 of 17
(2,792 Views)