Assignment
Add a graph to your temperature-monitoring VI that displays the Celsius temperature versus time. The graph should update in real time after each new point is acquired. (You can remove the data array indicator from the front panel that was created in the previous assignment.)
Download
Working version of VI (no block diagram access)
Textbook sections
XY Graphs (pp. 136-137)
Array Subset (pp. 311-312)
Transpose 2-D Array (p. 257)
Programming hints
LabVIEW offers several types of graph options. In this case, you'll want to use an X-Y Graph. The easiest way to do this is to select Express XY Graph from the Controls palette [Express » Graph Indicators » XY Graph]. This will allow you to drop the graph onto the front panel and gives you an Express VI in the block diagram to wire your data. Change the graph axes labels by simply double-clicking on the text.
Your data is in the 2-D array created in the previous assignment. The trick is in getting just the data you want from this array to wire to the graph. First we'll need to transpose the array (i.e. flip the rows and columns around). So begin by selecting the Transpose 2D Array function from the Array subpalette and wire your 2-D array to its input. See what the new array looks like by right-clicking on the output of the Transpose 2D Array function and selecting Create » Indicator. This will make the array appear on the front panel. Resize it to show all four rows. You'll notice that the first row contains the times, the second row the Celsius temps, the third the Fahrenheit temps, and the fourth the Kelvin temps. You can then simply delete the indicator from the front panel.
The x-data for our graph is now in the first row of the transposed array and the y-data is in the second row. We can pull out just the data we need using the Array Subset function found on the Array subpalette. You'll need to drop two of these functions onto your block diagram and wire the transposed array to the input of each. In the first case, select the x-data by using an index of 0 (for the 0th row of the array) and a length of 1 (since we just want one row). Now wire the output to the X Input of the Build XY Graph Express VI. (You'll notice that a data conversion function is automatically added.) Now repeat these steps for the y-data. What inputs will you use?
Front panel (example)