EXERCISE 1
1.A) Front Panel
- Open the
Spreadsheet ExampleVI located in theC:\Exercises\LabVIEW Basics Idirectory. The front panel in Figure 1 is already built.Figure 1
1.B) Run the VI
- Run the VI. The VI generates a 2D array of 128rows×3columns. The first column contains data for a sine waveform, the second column contains data for a noise waveform, and the third column contains data for a cosine waveform. The VI plots each column in a graph and displays the data in a table.
- When the
Choose file to writedialog box appears, save the file aswave.txtin theC:\Exercises\LabVIEW Basics Idirectory and click theOKbutton. Later, you will examine this file.
1.C) Block Diagram
- Display and examine the block diagram for this VI.
Figure 2 The
Sine PatternVI located on theFunctions>>All Functions>>Analyze>>Signal Processing>>Signal Generationpalette returns a numeric array of 128 elements containing a sine pattern. The constant90.0, in the second instance of theSine PatternVI, specifies the phase of the sine pattern or cosine pattern.The
Uniform White NoiseVI located on theFunctions>>All Functions>>Analyze>>Signal Processing>>Signal Generationpalette returns a numeric array of 128 elements containing a noise pattern.The
Build Arrayfunction located on theFunctions>>All Functions>>Arraypalette builds the 2D array from the sine array, noise array, and cosine array, as shown in Figure 3.Figure 3 The
Transpose 2D Arrayfunction located on theFunctions>>All Functions>>Arraypalette rearranges the elements of the 2D array so element {i,j}becomes element {j,i}, as in Figure 4.Figure 4 The
Write To Spreadsheet FileVI located on theFunctions>>All Functions>>File I/Opalette formats the 2D array into a spreadsheet string and writes the string to a file. The string has the format shown in Figure 5, where an arrow indicates a tab, and a paragraph symbol (¶) indicates an end of line character.Figure 5 The
Number To Fractional Stringfunction located on theFunctions>>All Functions>>String>>String/Number Conversionpalette converts an array of numeric values to an array of strings that the table displays.
- Close the VI. Do not save changes.
NOTE:
This example stores only three arrays in the file. To include more arrays, increase the number of inputs to theBuild Arrayfunction.
1.D) Optional
Open the
wave.txt file using a word processor or spreadsheet application and view its contents.- Open a word processor or spreadsheet application, such as (Windows) Notepad or WordPad, (Mac OS) SimpleText, or (UNIX) Text Editor.
- Open
wave.txt. The sine waveform data appear in the first column, the random waveform data appear in the second column, and the cosine waveform data appear in the third column. - Exit the word processor or spreadsheet application and return to LabVIEW.
No comments:
Post a Comment