Table Of Contents

Array to Spreadsheet String (G Dataflow)

Last Modified: January 9, 2017

Converts an array of any dimension to a delimited string that mimics a spreadsheet with rows, columns, and pages.

connector_pane_image
datatype_icon

format string

A string that includes a single format specifier to determine how to convert each element of an array into text.

Each format specifier uses the following general syntax:

% modifiers specifier

This node allows only the following specifiers: s, d, and f. Use %s to convert an array of strings to spreadsheet string. Use %d or %f to convert an array of numbers to spreadsheet string.

Modifiers for Numeric Specifiers (x, o, b, d, u, f, e, g, p)

If you use multiple modifiers, they must appear in the following order:

%[-][+][#][0][width][.precision || _significantDigits]specifier

Modifier Definition Usage Example Output for 12345
0

Pads any excess space to the left of a numeric parameter with zeros rather than with spaces to reach minimum width.

%06_2f 012000
+

Includes the sign of the number even when the number is positive.

%+6_2f +12000
#

Removes zeros at the end of the number.

-

Left justifies the output within its width. If LabVIEW inserts spaces to create the specified width, the spaces appear to the right of the value.

%-6_2f 12000_
width

A number specifying the minimum number of characters that LabVIEW uses in the output. If the value requires fewer characters, LabVIEW pads the output with spaces to meet this width.

This width is not a maximum width. LabVIEW uses as many characters as necessary to output the value without truncating it.

Non-numeric characters, such as a decimal point or negative sign, count toward the total width of an output string.

If width is missing or 0, the output uses only as many characters as necessary to contain the formatted value.

%6f _12345
width.precision

A number specifying how many digits appear to the right of the decimal point in the output.

If neither .precision nor _significantDigits is present, LabVIEW uses a precision of six digits.

If precision is 0, LabVIEW rounds the value to the nearest whole number.

%6.2f 12345.00
width_significantDigits

A number specifying how many significant digits appear in the output. LabVIEW rounds the data only for display purposes, which does not affect the original data.

You cannot use .precision and _significantDigits together in a single format specifier.

%6_2f _12000

Modifiers for the String Specifier (s)

Use the following syntax to format a string:

%[-]width s

Modifier Definition
-

Left justifies the output within its width. If LabVIEW inserts spaces to create the specified width, the spaces appear to the right of the value.

width

A number specifying the minimum number of characters that LabVIEW uses in the output. If the value requires fewer characters, LabVIEW pads the output with spaces to meet this width.

This width is not a maximum width. LabVIEW uses as many characters as necessary to output the value without truncating it.

If width is missing or 0, the output uses only as many characters as necessary to contain the formatted value.

Syntax for Literal Text Outside the Format Specifier

Most text you enter outside the format specifier appears literally in the output for each array element. However, you must use the following syntax if you want to output certain special characters.

Syntax Definition
\00 - \FF Hex value of an 8-bit character; must be uppercase
\b Backspace (ASCII BS, equivalent to \08)
\f Form feed (ASCII FF, equivalent to \0C)
\n Linefeed (ASCII LF, equivalent to \0A). Format into File automatically converts this code into the platform-dependent end-of-line character.
\r Carriage return (ASCII CR, equivalent to \0D)
\t Tab (ASCII HT, equivalent to \09)
\s Space (equivalent to \20)
\\ Backslash (ASCII \, equivalent to \5C)
%% Percent sign
datatype_icon

array

The values to convert to text.

datatype_icon

delimiter

A character or string of characters used to separate fields in the spreadsheet text. For example, a value of , (comma) specifies a single comma as the delimiter.

Default: \t — single tab character

datatype_icon

spreadsheet string

A string containing the data from array that mimics the table layout of a spreadsheet.

This string separates column elements with a specified delimiter, separates rows with a platform-dependent EOL character, and separates higher dimensions with a special header syntax of the form [highest dimension index, next highest dimension index, ... , 0, 0], where the final 0's refer to the first row and column elements of the page.

Where This Node Can Run:

Desktop OS: Windows

FPGA: All devices (only within an Optimized FPGA VI)


Recently Viewed Topics