Skip to content Skip to navigation

Connexions

You are here: Home » Content » Spreadsheet Example VI

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of 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.

      What are tags? tag icon

      Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

    • External bookmarks
  • E-mail the author
  • Rate this module (How does the rating system work?)

    Rating system

    Ratings

    Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

    How to rate a module

    Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

    (0 ratings)

Lenses

What is a lens?

Definition of 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.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

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.
  • National Instruments display tagshide tags

    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.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

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.

Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.

Exercise 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
    Figure 1 (spreadex.png)

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
    Figure 2 (spreadexbd.png)
    • sinepaticon.png 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.
    • uniform.png 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.
    • BuildArrayicon.png 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
      Figure 3 (BuildArray.png)
    • trans2daryicon.png 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
      Figure 4 (transarry.png)
    • wrtspreadfileicon.png 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
      Figure 5 (writespread.png)
    • num2fracstrgicon.png 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?

Send feedback