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.
![]() |
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.
![]() |














"A full introductory course on programming with LabVIEW."