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: 

using time-stamps from a spreadsheet file to be shown in the x-axis of xy graph

I am trying to generate a spreadsheet file from a random number generator inside a while loop with time stamps and then read the file simultaneously. I want to know how can I use the time stamps in the file to be displayed in the x-axis of a waveform graph or a x-y graph.

 

I am attaching my code with this post.

0 Kudos
Message 1 of 2
(1,997 Views)

Please do not post VIs with infinite loops (at least without informing us that they work that way)! The loop should have a stop button on the front panel wired to the stop terminal in the loop. If you use the Abort button to stop the VI, the file never gets closed.

 

A long time Forum participant has said that: "Using the Abort button to stop a VI is like using a tree to stop a car. It works but may have unintended consequences!"

 

To get the format you want after reading you need to convert the first column in the spreadsheet file from a date-time string to a numeric which can be interpretted by the graph as a timestamp. With the format you have chosen for the file it is somewhat complicated. Spend some time reading the detailed help for the timestamp and string format functions.

 

In the VI attached the file is read as string. The first column is separated into 7 numerical values to create a date-time record (cluster) which is then converted to a timestamp and then to DBL. The second column is converted to an array of DBL. The arrays are bundled and connected to an XY graph. The graph X-Axis is formatted as Absolute Time, AM/PM, HH:MM:SS. You can add the fractional seconds if you want but the scale starts to get crowded.

 

Also, the error out wires from the property nodes used to initialize the graphs should be wired to the loop to assure that they execute first.

 

Lynn

0 Kudos
Message 2 of 2
(1,976 Views)