Você está na página 1de 53

GETTING DATA

INTO AND OUT OF


LABVIEW WITHOUT
DATA ACQUISITION
By
S.N Masondo

INTRODUCTION
Data Acquisition is a common way of
getting
data into and out of LabVIEW.
LabVIEW is also
capable of reading and writing files
that can be used by other
programs(such as spreadsheet
programs)
LabVIEW supports several types of
Data files, the type of file format

FILE FORMAT
Text Files Interchange data with other
programs
Write to text files(.txt) used for
single values
Write to Spreadsheet file(.txt) used
for 1D or 2D arrays or matrices
Write to measurement file(.lvm)
used to send acquired
data(waveforms) to text files
VIs that perform the

WRITING LABVIEW DATA TO


SPREADSHEET FILE
Text files(.txt) created by LabVIEW can be
opened in spreadsheet programs such as
Excel.
Writing data to a Spreadsheet file is the
mechanism used to move LabVIEW data
into a spreadsheet program.
A LabVIEW spreadsheet file is a text file
that spreadsheet files such as Excel can
read, but LabVIEW does not create .xls
or .xlsx directly, however opening a .txt
file on Excel makes no significant
difference.

WRITING LABVIEW DATA TO


SPREADSHEET FILE
Function palette/Programming/[ File I/O]/Write to
spreadsheet file

WRITING LABVIEW DATA TO


SPREADSHEET FILE

Run the VI, a


choose
file to write
Dialog opens to allow
you to select a folder to
save youre text file.

SAVED SPREADSHEET FILE

OPEN SPREADSHEET FILE

WRITE TO SPREADSHEET FILE


TERMINALS ANNOTATION
Inputs
Format(%.3f) the format string used to
write the values to the text file.
File path(dialog if empty) this is a path
variable indicating where the file should
be stored, if no path specified , the
Choose file to write dialog is open to
determine the path at run time.
2D Data the terminal used for 2D
arrays
1D Data the terminal used for 1D array

WRITE TO SPREADSHEET FILE


TERMINALS ANNOTATION
Append to file(new file:F) a Boolean (True or
False) value used to tell LabVIEW how to
handle the data if the file already exists. True
means append the data to the data already
in file. False(default) means overwrite data.
Transpose?(no: F) a Boolean value
indicating whether or not should data be
transposed(Rows and columns interchanged)

Output
New file path provides programmatic
access to saved data

FORMAT STRINGS ANNOTATION


Format for writing floating point
numbers
Begins with character %
Sometimes includes ^ to force
engineering notation in multiples of
three, e.g. e3, e6
Sometimes a # symbol - instructs
LabVIEW to drop trailing zeros
Sometimes includes a period and a
number(e.g. .3) indicating the number
of decimals to show

FORMAT STRINGS ANNOTATION


f floating point notation(decimal point)
e scientific notation
g LabVIEW uses f or e depending on size of
a number

Example using number 12.3450000


String format Number

String format

Number

%.3f

12.345

%.3e

1.235e1

%.7f

12.3450000

%^.3e

12.345e0

%#.7f

12.345

%g

12.345000

%e

1.232400e1

%#g

12.345

USING FORMAT STRING

WRITING LABVIEW DATA TO


MEASUREMENT FILE
A LabVIEW measurement file(file
extension .lvm) is a text file used to save
waveform data
LabVIEW waveform is a collection of data
points collected over time plus some
additional header information
Measurement files are commonly used to
save data points acquired using DAQ
system.
LabVIEW can re-load the written data for
analysis

WRITING LABVIEW DATA TO


MEASUREMENT FILE
A measurement file is created using the
Write to measurement file express VI,
remember an express VI is a VI that
comes with a dialog box for configuration.
Measurement file location:
Functions palette/Programming
group/File IO group/Write to
measurement file

You can Identify an express VI by a blue


border around the icon in function palette

WRITE TO MEASUREMENT FILE VI


DIALOG BOX

WRITE TO MEASUREMENT FILE VI

FRONT PANEL

SAVED TEXT FILE

READING A LABVIEW
MEASUREMENT FILE

Function palette/Programming
Group/[File IO Group]/Read
Measurement file

READING A LABVIEW MEASUREMENT


FILE EXPRESS VI DIALOG BOX

READING A LABVIEW MEASUREMENT


FILE FRONT PANEL

READING A LABVIEW SPREADSHEET


FILE
LabVIEW provides a read from
spreadsheet file which can be used to
read text files
LabVIEW does not read Excel files
directly, but an Excel workbook can be
saved as a tab-delimited text file
Before saving Excel workbook as a text
file, extraneous information such as
headers(column header, row header
etc) must be removed

EXCEL WORKSHEET WITH


EXTRANEOUS INFORMATION

EXCEL WORKSHEET WITHOUT


EXTRANEOUS INFORMATION

SAVING TEXT FILE

Extension
file(.txt)
Tabdelimited
type

READ FROM SPREADSHEET


FUNCTION

Function
Palette/Programming
Group/File IO
Group/Read From
Spreadsheet file.vi

READ FROM SPREADSHEET


FUNCTION
Most of the terminals on Read from
spreadsheet file have been explained,
here our primary focus will be on the
most relevant terminals.
All rows array element can be added
on by simple right clicking on the
terminal in question, create, Indicator.
File path to direct LabVIEW must use
Computer language(separator \)

READ FROM SPREADSHEET PANEL

PULLING SINGLE COLUMNS/ROWS


FROM 2D ARRAY
Once the array values have been read
from a file to into LabVIEW, they can be
used for other calculations.
One may need only a specific column
or row
LabVIEW provides an Index Array
function that can be used to pick up a
particular row or column
Function Palette/Programming
Group/Array Group/Index Array

EXAMPLE PULLING COLUMNS

EXAMPLE PULLING COLUMNS

EXAMPLE USING PULLED COLUMNS

USING SPREADSHEET TO INITIALIZE


MATRIX CONTROL
Read the text file and show the
results in an array indicator
Change the array indicator to a
control
Delete the Read from spreadsheet
functions as well as any broken wires
Make the current data the default
values for the control

STEP 1

STEP 2

STEP 3

STEP 4

GETTING DATA INTO AND OUT OF


LABVIEW APPLICATION
LabVIEW provides a way to take an
advantage of DATA acquired by other
various software's products
Take Excel for instance, it is without a
doubt handy when working with data,
but It doesnt provide manipulation
functions such as an interpolator
function
In this example well export Excel data
to LabVIEW and perform interpolation

APPLICATION
CONSIDER THE ORIGINAL DATA OF A
DECAYING SINE/OSCILLATION

STEP 1
Read the decaying oscillation data
points into LabVIEW

STEP 2: SHOWING ORIGINAL DATA


POINTS

STEP 3: USING INTERPOLATION


FUNCTION
Mathematics Group/Interpolation
&Extrapolation/1D interpolation.vi

STEP 4: INTERPOLATED RESULTS

STEP 5: WRITING RESULTS TO A


TEXT FILE

STEP 6: DATA SENT BACK TO EXCEL

READING THE FIRST COLUMN/ROW


FROM A TEXT FILE

TRANSPOSE(NO:F)
Here the primary focus is on the
Transpose terminal
Reading one row By default(NO:F) the
first row on Read from spreadsheet
function will read one row from text file.
Reading one column Send a true
Boolean value to transpose terminal on
the Read from spreadsheet function, the
output will display a COLUMN

TRANSPOSE TRUE(1) BOOLEAN

TRANSPOSE FALSE(0) BOOLEAN

CONCLUSION

THANK
YOU!!!