LABVIEW HANDOUT 5
CHAPTER 5: DATA FILES AND CHARACTER STRINGS
Open a Blank VI. Save it under the name Spreadsheet Storage. Place the Waveform
Simulator VI on the Block Diagram and the Digitizing Parameters control and the Waveform
Parameters control on the Front Panel as shown below:
Functions>>Programming>>File I/O>>Write To Spreadsheet File.vi
Wire the output of the Unbundle by Name (Displacement) icon to the 1D data input of the
Write To Spreadsheet File.vi. When you run the VI, a dialog box called Choose file to write
will appear. Save the output to Sine Wave Data and then click on OK. Open Sine Wave Data
with Notepad:
Change the how the Spreadsheet Storage VI stores the data by transposing the output data.
Right-click on the green input on the bottom and create a constant. It will automatically be the
correct type of constant (Boolean):
When asked for the output file, double-click on the existing Sine Wave Data file. The output is
now stored in a single column:
Modify the VI to store both the time and displacement data in separate columns as shown below.
Resize the Build Array icon so that it has two inputs. Wire the output of the Build Array icon
to the 2D data input of the Write To Spreadsheet File.vi:
Functions>>Programming>>Array>>Build Array
Run the program and reopen the Sine Wave Data file.
Change the output format of the Write To Spreadsheet File.vi by wiring a String Constant to
the Format input by right-clicking on the input and creating a constant or by:
Functions>>Programming>>String>>String Constant
The output format by default is %.3f, which means that the output number is a floating point
number with three digits behind the decimal point. Change the output format by specifying a
floating point number in scientific notation with six digits behind the decimal point.
Right-click on the file path input on the Write To Spreadsheet File.vi to create a File Path
Constant using the file path to the Sine Wave Data file:
Verify that the VI properly outputs the data to the file by deleting the Sine Wave Data file and
rerunning the VI. Save the VI and save a copy to Spreadsheet Storage (OpenWriteClose).vi.
Modify the VI by replacing Write To Spreadsheet File.vi with the following:
Open the Sine Wave Data file using Excel. The Text Import Wizard dialog box will appear: