Skip to content Skip to navigation

OpenStax_CNX

You are here: Home » Content » Formatting Spreadsheet Strings

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to 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 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.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "NSF Partnership" link to see all content affiliated with them.

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

  • 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.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • eScience, eResearch and Computational Problem Solving

    This module is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. OdegardAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

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.
 

Formatting Spreadsheet Strings

Module by: National Instruments. E-mail the author

Summary: In this lesson, you will learn how to format text files for use in spreadsheets.

To write data to a spreadsheet file, you must format the string as a spreadsheet string, which is a string that includes delimiters, such as tabs. In many spreadsheet applications, the tab character separates columns, and the end of line character separates rows.

Note:

Use the end of line constant located on the Functions>>All Functions>>String palette to ensure portability of VIs among platforms. (Windows) The constant inserts a carriage return and a linefeed. (Mac OS) The constant inserts a carriage return. (UNIX) The constant inserts a linefeed.

Use the Write To Spreadsheet File VI or the Array To Spreadsheet String function to convert a set of numbers from a graph, a chart, or an acquisition into a spreadsheet string. If you want to write numbers and text to a spreadsheet or word processing application, use the String functions and the Array functions to format the data and to combine the strings. Then write the data to a file.

Format Into File

Use the Format Into File function to format string, numeric, path, and Boolean data as text and write the text to a file. Often you can use this function instead of separately formatting the string with the Format Into String function or Build Text Express VI and writing the resulting string with the Write Characters To File VI or Write File function.

Use the Format Into File function to determine the order in which the data appears in the text file. However, you cannot use this function to append data to a file or overwrite existing data in a file. For these operations, use the Format Into String function with the Write File function. You can wire a refnum or path to the input file terminal of the Format Into File function, or you can leave this input unwired for a dialog box to prompt you for the filename.

In the block diagram shown in Figure 1, the Open/Create/Replace File VI opens a file, and the For Loop executes five times. The Format Into File function converts the iteration count and the random number to strings and places the tab and end of line characters in the correct positions to create two columns and one row in spreadsheet format. After the loop completes five iterations, the file closes, and the VI checks the error condition.

Figure 1
Figure 1 (frmtspreadstrg.png)

This VI creates this text file, where an arrow (→) indicates a tab, and a paragraph symbol (¶) indicates an end of line character.


	  0→ 0.798141¶
	  1→ 0.659364¶
	  2→ 0.581409¶
	  3→ 0.526433¶
	  4→ 0.171062¶
	

You can open the previous text file in a spreadsheet application to display the spreadsheet shown in Figure 2.

Figure 2
Figure 2 (frmtspreadstrgxls.png)

Write LabVIEW Measurement File

In the block diagram shown in Figure 3, the Write LabVIEW Measurement File Express VI includes the open, write, close, and error handling functions. It also handles formatting the string with either a tab or comma delimiter. The Merge Signals function combines the iteration count and the random number into the dynamic data type.

Figure 3
Figure 3 (frmtspreadstrg2.png)

The dialog box in Figure 4 shows the configuration for the Write LabVIEW Measurement File Express VI.

Figure 4
Figure 4 (formatlvm.png)

This VI creates a .lvm file which you can open in a spreadsheet application. Figure 5 shows an example of the spreadsheet created by the previous configuration of the Write LabVIEW Measurement File Express VI.

Figure 5
Figure 5 (frmtspreadstrgxls2.png)

Refer to the lesson on Data Acquisition and Waveforms, for more information about the Write LabVIEW Measurement File and Read LabVIEW Measurement File Express VIs.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to 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 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