Example Code

Plot a 2D Array with timestamps in a XY Graph using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

1. Overview

This example takes a 2D array of strings formatted as [Time, Data] each row, and displays it in a XY Graph.

 

2. Description

As we import data to LabVIEW, write data of our own, acquire it from instruments using NI-VISA, among other examples; we sometimes need to visualize it in an easy way. This data comes sometimes in a 2D array of strings, which we need to process and convert in order for a graph to plot it correctly.

This example shows how to accept an array of strings, in which every row comes in the following way:[Time, Data]; so that a plot can be displayed from it.

 

3. Requirements

NI LabVIEW Base Development System 2012 (or compatible).

 

4. Steps to Implement or Execute Code

  1. Download and run the VI
  2. If you need to scan differently the time stamps you're using in your array, refer to the string constant '%<%d/%m/%y %I:%M:%S%u %p>T' and modify to fit your needs.
  3. Change the Table control to read from a file, get data from a DAQ, or get a string array in any other way you need.

 

5. Additional Information or References

 

  Plot a 2D Array with timestamps in a XY Graph Screenshot.PNG

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.