Connexions

You are here: Home » Content » Graph Waveform Array VI
Content Actions
Lenses

What is a lens?

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

This content is ...
Affiliated with (?)
This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • This module is included in aLens by: National InstrumentsAs a part of collection:"LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    National Instruments
Also in these lenses
  • This module is included inLens: Connexions Books Available for Print on Demand
    By: ConnexionsAs a part of collection:"LabVIEW Graphical Programming Course"

    Comments:

    "This book is available through the Connexions beta version of print-on-demand from online materials."

    Click the "Printable Books" link to see all content selected in this lens.

    Printable Books
Tags

(?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Graph Waveform Array VI

Module by: National Instruments

Summary: To create an array by auto-indexing a For Loop and to plot the array on a waveform graph.

Problem 1
Complete the following steps to build a VI that generates and plots an array on a waveform graph and modify the VI to graph multiple plots.

1.a) Front Panel

  1. Open a blank VI and build the front panel shown in Figure 1.
    Figure 1
    1. Place an array, located on the Controls>>All Controls>>Array &Cluster palette, on the front panel.
    2. Label the array Waveform Array.
    3. Place a numeric indicator, located on the Controls>>Numeric Indicators palette, in the array shell.
    4. Place a waveform graph, located on the Controls>>Graph Indicators palette, on the front panel.

1.b) Block Diagram

  1. Build the block diagram shown in Figure 2.
    Figure 2
    1. Place the Thermometer VI on the block diagram. Select Functions>>All Functions>>Select a VI and navigate to C:\Exercises\ LabVIEW Basics I\Thermometer.vi. This subVI returns one temperature reading during each For Loop iteration.
      Note: Use the (Demo) Thermometer VI if you do not have a DAQ device available.
    2. Place a For Loop, located on the Functions>>All Functions>>Structures palette, on the block diagram. In this exercise, each For Loop iteration generates a temperature value and stores it in the indexed tunnel. Create a constant of 100 for the count terminal.
    3. Wire the block diagram as shown in Figure 2.
      Note: When you wire data to charts and graphs, refer to the Context Help window for more information about wiring the objects, including whether to use a Build Array or Bundle function, the order of the input terminals, and so on. In general, use a waveform chart for single scalar points, a waveform graph for an array of y values, and an XY graph for an array of xx values and an array of yy values. For example, if you move the cursor over a waveform graph terminal on the block diagram, the information shown in Figure 3 appears in the Context Help window. Select Help>>Find Examples to launch the NI Example Finder, double-click Fundamentals, double-click Graphs and Charts, and double-click the Waveform Graph VI to open the example. Refer to the lesson on Data Acquisition and Waveforms for more information about the waveform data type.
      Figure 3
  2. Save the VI as Graph Waveform Array.vi in the C:\Exercises\LabVIEW Basics I directory.

1.c) Run the VI

  1. Display the front panel and run the VI. The VI plots the auto-indexed waveform array on the waveform graph.
  2. Enter the index of any element in the Waveform Array index display to view the value of that element. If you enter a number greater than the array size of 100, the display dims.
  3. Use the Positioning tool to resize Waveform Array to view more than one element. The indicator displays elements in ascending index order, beginning with the index you entered.

1.d) Block Diagram

In this block diagram, you use the default value of the initial xx and Δx Δ x value for the waveform. In cases where the initial xx and Δx Δ x value are a specific value, use the Bundle function to specify an initial xx and Δx Δ x value for a waveform array.
  1. Modify the block diagram as shown in Figure 4.
    Figure 4
    1. Place the Bundle function, located on the Functions>>All Functions>>Cluster palette, on the block diagram. This function assembles the plot elements into a single cluster. The elements include the initial xx value (2020), the Δx Δ x value (0.50.5), and the yy array of waveform data.
    2. Create two numeric constants for the initial xx value and Δx Δ x value.
    3. Label the Δx Δ x constant by typing Dx. Use the Labeling tool to select the D and select the Symbol font from the Text Settings pull-down menu on the toolbar. D converts to the delta symbol (Δ).
    4. Wire the block diagram as shown in Figure 4.
  2. Save the VI.

1.e) Run the VI

  1. Display the front panel and run the VI. The graph displays the same 100100 points of data with a starting value of 2020 and a Δx Δ x of 0.50.5 for each point on the x-axis. In a timed test, this graph would correspond to 5050 seconds worth of data starting at 2020 seconds.
    Note: Change the initial xx and Δx Δ x values in only one location, either the Bundle function or in the Waveform Graph Properties dialog box.
  2. If time permits, complete the optional steps. Otherwise, close the VI.

1.f) Optional

  1. Right-click the waveform graph and select Visible Items>>Graph Palette from the shortcut menu to display the graph palette. Click the Zoom button to see the data on the graph in more detail.
  2. Right-click the graph and select Visible Items>>Scale Legend from the shortcut menu to display the scale legend.
  3. Return to the block diagram. Create a multiple-plot waveform graph by building a 2D array of the data type normally passed to a single-plot graph. Modify the block diagram as shown in Figure 5.
    Figure 5
    1. Place the Sine function, located on the Functions>>Arithmetic & Comparison>>Express Numeric>>Express Trigonometric palette, on the block diagram. Use this function to build an array of points that represents one cycle of a sine wave.
    2. Place the Build Array function, located on the Functions>>All Functions>>Array palette, on the block diagram. This function creates the data structure to plot two arrays on a waveform graph.
    3. Place the pi constant, located on the Functions>>Arithmetic & Comparison>>Express Numeric>>Express Numeric Constants palette, on the block diagram.
    4. Wire the block diagram as shown Figure 5.
  4. Save the VI.
  5. Display the front panel and run the VI. The two waveforms plot on the same waveform graph.
  6. Display the block diagram.
  7. Right-click the wire to Waveform Array , select Custom Probes>>Controls>>Graph Indicators from the shortcut menu, and select a waveform graph to place a graph probe on the wire.
  8. Display the front panel and run the VI. The probe shows only the data array. The sine wave is not present because you did not place the probe on the wire to which the sine wave is bundled.
  9. Close the Probe window.
  10. Zoom in on a portion of the graph.
    1. Click the Zoom button on the graph palette, shown in 12, to display the Zoom pull-down menu.
    2. Select Zoom by X Rectangle, as shown in Figure 6.
      Figure 6
    3. Click and drag a selection rectangle on the graph. When you release the mouse button, the graph display zooms in on the selected area.
    4. You also can select Zoom by Y Rectangle or Zoom by Selected Area. Experiment with these options.
    5. Select Undo Zoom from the lower left corner of the pull-down menu to undo a zoom or click the x-axis single fit button and the y-axis single fit button on the scale legend, shown in 14 and 15.
  11. Use the Panning tool, shown in 16, to click and drag the graph display. Click the x-axis and y-axis single fit buttons again to restore the display to its original position.
  12. Use the Cursor Movement tool, shown in 17, to return the cursor to standard mode.
  13. Save and close the VI.

Comments, questions, feedback, criticisms?

Discussion forum

Send feedback