0% found this document useful (0 votes)
60 views29 pages

Virtual Instrumentation: Topic To Be Dealt

The document discusses various topics related to virtual instrumentation including arrays, clusters, file I/O, and strings. It provides definitions and examples of arrays, operations to manipulate arrays like initializing, building, and indexing arrays. It also discusses clusters including creating, bundling, unbundling clusters. File I/O concepts like ASCII, binary, and data log file formats are explained along with functions for opening, reading, writing files.

Uploaded by

Sudha Santhosh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views29 pages

Virtual Instrumentation: Topic To Be Dealt

The document discusses various topics related to virtual instrumentation including arrays, clusters, file I/O, and strings. It provides definitions and examples of arrays, operations to manipulate arrays like initializing, building, and indexing arrays. It also discusses clusters including creating, bundling, unbundling clusters. File I/O concepts like ASCII, binary, and data log file formats are explained along with functions for opening, reading, writing files.

Uploaded by

Sudha Santhosh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Virtual instrumentation

TOPIC TO BE DEALT
 ARRAYS & CLUSTERS
 FILE I/O
 STRINGS

 Prepared by Sudha R, E&I Dept.

Jeppiaar Engineering College


ARRAYS & cluster- Definitions
 An Array is a collection of data elements of same data type

 An array can have one or more dimensions and up to 231 elements per
dimension

The size of an array can be changed dynamically.


An array can be of any data type EG Boolean numeric or string etc.. except another
array, a chart or a graph
 An array with n elements is indexed from 0- n-1. with first element at index 0 &
last one as index n-1
 A Cluster is also a data structure that groups data of different data type.
 Cluster have fixed size
 Similar to a record in Pascal or structure in C
CREATING ARRAY CONTROLS & INDICATORS
 An Array Control Or Indicator Is Created By First Choosing The Array Shell
And Then Depositing A Data Object Into It.
 All The Elements Of An Array Must Be Either Controls Or Indicators.

Creating an array( steps to be followed)


Corresponding Front Panel
Multi dimensional array
 We can add dimension to an array control or indicator by popping up on its
index display and choosing Add Dimensions
 array constants
Used to store constant data or as a basis for comparison with another array.
ARRAY OPERATIONS
 Lab view provides many operations to manipulate arrays
 Array size:
 Array size function returns the number of elements in each dimension of
array. If input is n dimension , the output will be one dimensional array
with n elements

 Initialize array :
 It creates an n dimensional array with elements with values specified at the
input. The use of this function is to allocate memory of the array. The data
type of the array is determined by what input is connected.
ARRAY OPERATIONS
Build Array:
 Build array is use to concatenate multiple array or to append extra
elements to an array.
 Build Array has two modes of operation based on concatenate Input option
selected or not.The default for this function is to Append to the original
array.
 If the concatenate Input option is selected , the function appends all the
inputs in order forming an output array of the same dimension
 If the concatenate option is not selected , the output will have one
dimension higher than the dimension of input.
Steps for append
1. Functions Palette → All-Functions → Arrays and Clusters → Build Array
2. Wire “Array” Terminal → Top Terminal of Append/Build Array Function
3. Branch a wire from the Output of the Initialize Array Function → Bottom
Terminal of Append/Build Array Function
4. Wire Output of Append/Build Array Function → “Appended Array” Array
Indicator
 Steps for Concatenate
 Functions Palette → All-Functions → Arrays and Clusters → Build
Array → Right-Click on Build Array Function → Concatenate
 Wire “Array” Terminal → Top Terminal of Concatenate/Build Array
Function
 • Branch a wire from the Output of the Initialize Array
 Function → Bottom Terminal of Concatenate/BuildArray Function
 • Wire Output of Concatenate/Build Array Function →
 “Concatenated Array” Array Indicator
ARRAY OPERATIONS
Array sub set
 Array sub set function returns a portion of input array starting at specified
index and containing length of elements. Once the array is wired to input
the function automatically resizes to display index inputs for each
dimension in the array.
ARRAY OPERATIONS
Index array
 Index array returns the element specified by the index or returns a sub
array of n dimension array at index
 The function resizes automatically to display the index inputs
clusters
A cluster combines one or more data types into
one data type.
 It elliminates wire clutter in block diagram and
reduces the no of connector panes terminal.
Like an array it can either be a control or
indicator
On the block diagram the cluster will appear like
rope and an icon. Similar to arrays the object has
to be depositted in a cluster.
Cluster operations
 The main cluster operations are
 Bundle
 Unbundle
 Bundle by name
 Unbundle by name
 Bundle: The bundle function assembles individual components into a
single new cluster and also allows one to replace elements in existing
order. As the input terminal is wired a symbol representing the data
types appears on empty terminal. The order of the cluster will be the
order of input to bundle
clusters

 BUNDLE
UNBUNDLE
The unbundle function splits a cluster into
individual components
EXAMPLE
BUNDLE BY NAME
Sometimes it is required to operate on an element
rather than entire cluster. In bundle by name the
element are referenced by name rather than position
We can access only the element needed.
This function cannot create a new cluster only can
replace existing clusters.
UNBUNDLE BY NAME
Unbundle by name function returns the cluster
elements whose names are specified. The major
advantage is that one does not have to keep track of
order of elements within cluster.
ARRAY TO CLUSTER
Array to cluster converts an n element one
dimensional array into a cluster of n elements of same
data type.
File I/O concepts
File I/O operations pass data to and from files

Most Instrumentation application require to store the


data in some standard format.
File Formats-
 ASCIITEXT FORMAT FILES
 BINARY FORMAT FILES

 DATA LOG FILES


ASCII TEXT FORMAT FILE:
 ASCII text format files stores data in ASCII format
 It is the simplest format to use and share. Any computer can read
or write form a text file.
 The data is stored in text format when we want to acess it from
another application such as word processor or spread sheet.
 To store data in text format, use the String functions to
convert all data to text strings. Text files can contain
information of different data types.
 Text files typically take up more memory than binary and data log
files, because the ASCII representation of data usually is larger
than the data itself.
 BINARY FORMAT FILE:
 This Stores The Data In Binary Format and looks like an image of data
stored in computer memory. And Cannot Be Read By Word Processor.
 Main advantage is that file size is much smaller than text files.
 Binary formats are useful in writing or reading large chunk of data due
to its size advantage.
 DATLOG FORMAT FILE
 Data format file is special binary format file. The data is stored as a
sequence of records of single arbitrary data type specified during the
creation of the files. Each record in a datalog file must have the same
data types associated with it.
 LABVIEW allows read acess to these file and timestamps are also
included in each record.
 Data log files is used to acess and manipulate data
File i/o functions
Opening and closing data files.
• Reading data from and writing data to files. 
• Reading from and writing to spreadsheet-formatted
files.
 • Moving and renaming files and directories.
• Changing file characteristics.
 • Creating, modifying, and reading a configuration file.
 Use the high-level VIs to perform common I/O
operations. Use the low-level VIs and functions to
control each file I/O operation individually.
 

You might also like