Blog

Initializing Arrays In Labview

  • (4.0)
  • | 2961 Ratings

Initializing Arrays

You can initialize an array, or leave it uninitialized. When an ARRAY is initialized, you can define the number of elements in each dimension and the contents of each element. An uninitialized array has a dimension but no elements. The below Figure(a) shows an uninitialized TWO-DIMENSIONAL array control with all the elements are dimmed indicating that the array is uninitialized. The below Figure (b) shows initialized array of two rows and two columns.

 Initializing Arrays

LABVIEW Arrays Example

Description: Working and manipulating with Arrays is an important part in LabVIEW development. Arrays are very powerful to use in LabVIEW. In all your applications you would probably use both One-Dimensional Arrays and Two-Dimensional Arrays.

Enhance your IT skills and proficiency by taking up the LabVIEW Training.

On the Front Panel using the CONTROL PALETTE we can create an array as follows (Array, Matrix & Cluster subpalette):
LABVIEW Arrays Example

You drag and drop the empty Array on the FRONT PANEL, next you find a Control or Indicator (Numeric, String, Boolean, etc,) and drag it into the empty Array. You can create an Array of (almost) any kind of Control or Indicator.

Frequently Asked LabVIEW Interview Questions & Answers

2D OR MULTIDIMENSIONAL ARRAY? Just drag the mouse in the Index display to the left and increase the dimension.

  array
On the Block Diagram we have the following Array palette available from the Functions palette in LabVIEW:
block diagram

Use the Array functions to create and manipulate arrays. The most useful Array functions are:

array functionsAll these functions are basic (but very useful) array functions you will probably be using in all your applications and VIs.

Task: Build Array. This function concatenates multiple arrays or appends elements to an n-dimensional array. Try the simple example below. This example using the Build Array function inside a For loop in order build an array with 10 elements. 

task build arrayTask: Index Array. This function returns the element or subarray of n-dimension array at index. It is always useful to find a specific value in an array. The Index Array is extendible, so you can drag it out to find more than one elements. Try the simple example below.
index arrayTask: Array Size. This function returns the number of elements in each dimension of array. Try the simple example below. The example finds the size of an arbitrary array.

array size
Task: Auto-indexing. If you wire an array to a For Loop, you can read and process every element in that array by enabling auto-indexing. You also can enable auto-indexing by configuring a For Loop to return an array of every value generated by the loop. Create a simple example in order to see the difference

auto indexing

Explore LabVIEW Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Subscribe For Free Demo

Free Demo for Corporate & Online Trainings.

Ravindra Savaram
About The Author

Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.


DMCA.com Protection Status

Close
Close