Home  >  Blog  >   Labview

Labview – Array Controls, Indicators, Constants

Rating: 4
  
 
8529
  1. Share:
Labview Articles

One - Dimensional Array

Create an Array control or indicator on the Front Panel by placing an array shell on the front panel as shown in below Figure (a), and dragging a data object or element, which can be a numeric, Boolean, string, path, refnum, or cluster control or indicator, into the array shell. The array shell automatically resizes to accommodate the new object. The array shell can be selected from Controls >> Modern >> Arrays, Matrix & Clusters palette. The array elements must be Controls or Indicators. You must insert an object in the array shell before you use the array on the Block diagram. Otherwise, the array terminal appears black with an empty bracket. After placing an element in the array shell, you can expand the array either horizontally or vertically to see more elements. Once a data type is assigned to the array shell, the block diagram takes the color and lettering (In [ ] brackets) of the data type. For example, if the data type is a numeric indicator, the color will be orange with [DBL] written inside the terminal. Arrays can be identified easily by their thicker (or double) wires. The below Figure (b) shows an array of numeric controls and the array has four elements. The below Figure (c) shows an array of numeric indicators.

If you would like to Enrich your career with an Android certified professional, then visit Mindmajix - A Global online training platform: “LabVIEW training” Course.This course will help you to achieve excellence in this domain.

 

One Dimensional Array front panel
     
Front panel components


The index ranges from 0 to 3. The first element in the array (9) is at index 0, the second element (7) is at index 1, the third element (3) is at index 2 and the fourth element (5) is at index 3. In an array the element selected in the index display always refers to the element shown in the upper-left corner of the element display. In below Figure, the element (9) at index 0 is not shown in the array, because index 1 is selected in the index display. If you want to see the element 9 again, the index value in the index display should be changed to 0.           

 

Array Control
 

Array Constant

You can create an array constant on the Block Diagram by combining an array with a valid constant, which can be a numeric, Boolean, string, path, refnum, or cluster constant. The element cannot be another array. Following are the steps for creating an array constant in the block diagram.

  1. Select an array constant from Functions>>Programming>>Arrays palette; place the array shell on the block diagram. The array shell appears, with an index display on the left, an empty element display on the right, and an optional label.
  2. Place a constant in the array shell. For example, a numeric constant in the array shell.
  3. The array shell automatically resizes to accommodate the object you place in the array shell. When an object is placed in the array shell, the data type of the array constant is defined.
  4. An alternative method of creating array constant is to copy or drag an existing array on the front panel to the block diagram to create a constant of the same data type.

You can use an array constant to store constant data or as a basis for comparison with another array. Array constants are also useful for passing data into a subVI. The above Figure (d) shows an array of Boolean constants.

 MindMajix YouTube Channel

Two - Dimensional Arrays

A two-dimensional array is analogous to a spreadsheet or table. A two-dimensional array stores elements in a grid. It requires a column index and a row index to locate an element, both of which are zero-based. Two-dimensional arrays are very commonly used in data acquisition applications. For example, when waveforms from several channels are read from a data acquisition (DAQ) board, the data is stored in a two-dimensional array where each column in the array corresponds to data from one channel. To create a two-dimensional array on the front panel, right-click the index display of the array and select Add Dimension from the shortcut menu. You also can use the Positioning tool to resize the index display to have one more dimension. The below Figure shows a two-dimensional array.

 

Frequently Asked LabVIEW Interview Questions & Answers

 

Two dimensional array

 

Check Out LabVIEW Tutorials

Multi Dimensional Arrays

To create a multidimensional array on the Front Panel, right-click the index display of the array and select Add Dimension from the shortcut menu. You also can use the Positioning tool to resize the index display until you have as many dimensions as you want. To delete dimensions one at a time, right-click the index display and select Remove Dimension from the shortcut menu. You can also resize the index display to delete dimensions. Use the Positioning tool to resize the array to show more than one row or column at a time. To display a particular element on the front panel, either type the index number in the index display or use the arrows on the index display to navigate to that number. You can also use the scroll bars of an array to navigate to a particular element. Right-click the array and select Visible Items» Vertical Scrollbar or Visible Items»Horizontal Scrollbar from the shortcut menu to display scroll bars for the array as shown in the below Figure.

Multi Dimensional Arrays

   

Array with scroll bars

Explore LabVIEW Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!
Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
LabVIEW TrainingMar 23 to Apr 07View Details
LabVIEW TrainingMar 26 to Apr 10View Details
LabVIEW TrainingMar 30 to Apr 14View Details
LabVIEW TrainingApr 02 to Apr 17View Details
Last updated: 29 Apr 2023
About Author

Ravindra Savaram is a Technical 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.

read more
Recommended Courses

1 / 15