ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xy -Graph with timestamp

Hi forum,

 

i need help again. I have a .csv file from labview where the first row is a timestamp:

08/10/201423:45:53.871

 the other rows are floating data.

I would like to read this data and plot it with timestamp on the x-Axis. How i could do this in labview.


Thanks and best

Martin

0 Kudos
Message 1 of 11
(5,830 Views)

Hi Martin,

 

I recommend to put a space between date and time, but it works this way too:

check.png

Best regards,
GerdW


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

Hi gerd,

 

thanks for ur fast help! I still dont get how i could plot the graph, so i will read the first row as a string format it into a timestamp and then i just can plot it on the x axis? 

Best,

Martin

0 Kudos
Message 3 of 11
(5,814 Views)

Hi Martin,

 

you could either create an XY graph with an array of timestamps used for the x axis - or you could create a waveform using a single timestamp (as t0) and a fixed dt…

 

In your OP you only provided a single timestamp and no additional information, so all I could suggest is how to convert that timestamp string into a "real" LabVIEW timestamp!

Best regards,
GerdW


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

hi Gerd,

 

i will have in the firt row an array of timestamps and multible data points in the second row. The graph should look like in the picture attached i want to plot the first row(timestamps) on the x axis and the data points on the y axis.

I attached my vi but its not working. 


Thanks 
Martn

0 Kudos
Message 5 of 11
(5,803 Views)

Hi Martin,

 

you need to read in your data as "String" and convert the timestamps as I have shown above…

Best regards,
GerdW


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

Hi Gerd,

 

i still stuck i may dont get the idea. I attached my vi to plot the csv file. How i could read just the first row and format this to string the other row to foating points and then plot it. 

 

Thanks for your help

Martin

Download All
0 Kudos
Message 7 of 11
(5,753 Views)

 Hi Martin,

 

sorry for delay, but next time you should save your VI in LV2011…

 

See this:

check.png

- read in the text file and convert to array of strings

- get columns (instead of rows!) and convert each column depending on its datatype to timestamp and float

- plot data on XY graph

 

You went wrong on

- the format specifier for SpreadsheetStringToArray

- indexing rows instead of columns

- the whole process of data conversion: after converting to float you convert back to string to finally (trying) to convert back to timestamp…

 

Best regards,
GerdW


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

HI gerd,

 

thanks a lot!

It works fine 🙂 one other thing how i would make it if i wana plot 2 graphs on the y scale?

THanks 

Martin

0 Kudos
Message 9 of 11
(5,675 Views)
Simply create an array of the cluster that you are using now. Each element in the array is a separate plot. Note also that the order of plots in the array sets the z-axis order as well (what plots are on top of others visually).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 11
(5,648 Views)