|| 3.33 out of 5
How Can I Plot My Acquired Data Versus a Timestamp in LabVIEW?
Primary Software Version:
Primary Software Fixed Version:
I would like to plot my acquired data against its corresponding timestamp. How can I do this in LabVIEW?
There are two different ways to accomplish this, depending on the datatype of your acquired data:
- Waveform Data
A waveform data type is a cluster of three elements: the initial time when the first sample of data was acquired (t0), the increment or step between time values (dt), and the array of data collected (Y). If you have acquired your data as a Waveform data type, then you can wire it directly to a Waveform Chart or Graph. Refer to KnowledgeBase 1W3F9QHE in the Related Links below for steps on incorporating timestamp information as the x-axis for Waveform Charts and Graphs.
- Non-Waveform Data
If the data you are acquiring is raw data with no time information, you will need to create timestamps for each data point. Refer to the example LabVIEW VI (
Timestamp.vi) below in the Attachments and follow the steps below:
- Use the Get Date/Time In Seconds VI located in the Functions»Programming»Timing palette. Be careful NOT to use the Get Date/Time String function. Place this Get Date/Time In Seconds node inside the loop where you are accumulating your data.
- Within the loop, use the Bundle function to combine each data point and its corresponding timestamp. The output of the Bundle function will be a cluster of a data point and a timestamp.
Note: You need to wire the timestamp data to the first input of the bundle function (x-axis value) and the data point to the second input of the bundle function (y-axis value).
- Place an XY Graph on the Front Panel. Then on the block diagram wire the output of the Bundle function to the XY Graph terminal. Make sure to enable indexing on this cluster wire at the loop boundary. (Right-click the wire tunnel at the border of the loop and select Enable Indexing.)
- Right-click on the XY Graph in the front panel and navigate to and click on X Scale»Formatting.
- From the Format drop-down menu, select Time (X-Axis).
- Complete the desired formatting for the time and/or date as you would like it to be displayed on the x-axis.
- Select OK to save the changes.
For an example on how to make a graph with time stamps, please see the code example below.
Related Links: KnowledgeBase 1W3F9QHE: How Do I Set the Time and Date on the X-axis of a Graph in LabVIEW?
Attachments: - Timestamp.vi