Connexions

You are here: Home » Content » Spreadsheet Example 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.

Spreadsheet Example VI

Module by: National Instruments

Summary: In this exercise, the objective is to save a 2D array in a text file so a spreadsheet application can access the file and to display numeric data in a table. Complete the following steps to examine a VI that saves numeric arrays to a file in a format you can access with a spreadsheet.

Problem 1

1.a) Front Panel

  1. Open the Spreadsheet Example VI located in the C:\Exercises\LabVIEW Basics I directory. The front panel in Figure 1 is already built.
    Figure 1

1.b) Run the VI

  1. Run the VI. The VI generates a 2D array of 128rows×3columns 128 rows 3 columns . 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.
  2. When the Choose file to write dialog box appears, save the file as wave.txt in the C:\Exercises\LabVIEW Basics I directory and click the OK button. Later, you will examine this file.

1.c) Block Diagram

  1. Display and examine the block diagram for this VI.
    Figure 2
    • The Sine Pattern VI located on the Functions>>All Functions>>Analyze>>Signal Processing>>Signal Generation palette returns a numeric array of 128 elements containing a sine pattern. The constant 90.0, in the second instance of the Sine Pattern VI, specifies the phase of the sine pattern or cosine pattern.
    • The Uniform White Noise VI located on the Functions>>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 the Functions>>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 the Functions>>All Functions>>Array palette rearranges the elements of the 2D array so element ij i j becomes element ji j i , as in Figure 4.
      Figure 4
    • The Write To Spreadsheet File VI located on the Functions>>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 the Functions>>All Functions>>String>>String/Number Conversion palette converts an array of numeric values to an array of strings that the table displays.
  2. 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 the Build Array function.

1.d) Optional

Open the wave.txt file using a word processor or spreadsheet application and view its contents.
  1. Open a word processor or spreadsheet application, such as (Windows) Notepad or WordPad, (Mac OS) SimpleText, or (UNIX) Text Editor.
  2. 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.
  3. Exit the word processor or spreadsheet application and return to LabVIEW.

Comments, questions, feedback, criticisms?

Discussion forum

Send feedback