Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
36 ratings:
 3.19 out of 5     Rate this Document

How Can I Plot My Acquired Data Versus a Timestamp in LabVIEW?



Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 8.2
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I would like to plot my acquired data against its corresponding timestamp. How can I do this in LabVIEW?

Solution:
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:

    1. 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.

    2. 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).

    3. 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.)

    4. Right-click on the XY Graph in the front panel and navigate to and click on X Scale»Formatting.

    5. From the Format drop-down menu, select Time (X-Axis).

    6. Complete the desired formatting for the time and/or date as you would like it to be displayed on the x-axis.

    7. 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 - Timestamp.vi



Report Date: 12/17/2002
Last Updated: 09/22/2014
Document ID: 2SGBHKOK

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit