EXERCISE 1
1.A) Front Panel
- Open the
Spreadsheet Example
VI located in theC:\Exercises\LabVIEW Basics I
directory. 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 write
dialog box appears, save the file aswave.txt
in theC:\Exercises\LabVIEW Basics I
directory and click theOK
button. Later, you will examine this file.
1.C) Block Diagram
- Display and examine the block diagram for this VI.
Figure 2 - The
Sine Pattern
VI located on theFunctions>>All Functions>>Analyze>>Signal Processing>>Signal Generation
palette returns a numeric array of 128 elements containing a sine pattern. The constant90.0
, in the second instance of theSine Pattern
VI, specifies the phase of the sine pattern or cosine pattern. - The
Uniform White Noise
VI located on theFunctions>>All Functions>>Analyze>>Signal Processing>>Signal Generation
palette returns a numeric array of 128 elements containing a noise pattern. - The
Build Array
function located on theFunctions>>All Functions>>Array
palette builds the 2D array from the sine array, noise array, and cosine array, as shown in Figure 3.Figure 3 - The
Transpose 2D Array
function located on theFunctions>>All Functions>>Array
palette 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 File
VI located on theFunctions>>All Functions>>File I/O
palette 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 String
function located on theFunctions>>All Functions>>String>>String/Number Conversion
palette converts an array of numeric values to an array of strings that the table displays.
- The
- 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 Array
function.
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