National Instruments BridgeVIEW 用户手册

下载
页码 455
Chapter 14
Arrays, Clusters, and Graphs
© National Instruments Corporation
14-9
Using Auto-Indexing to Set the For Loop Count
Notice that the count terminal is left unwired. When you use auto-indexing 
on an array entering a For Loop, the loop executes according to the size of 
the array, eliminating the need to wire a value to the count terminal. If you 
use auto-indexing for more than one array, or if you set the count in 
addition to auto-indexing an array, the actual number of iterations is the 
smallest number possible.
3.
Run the VI. Of the eight input values, you will see four in the Positive 
Array and four in the Negative Array.
4.
From the block diagram, wire a constant of 5 to the count terminal of 
the For Loop. Run the VI. You will see three values in the Positive 
Array and two in the Negative Array, even though the input array still 
has eight elements. This demonstrates that if N is set and you are 
auto-indexing, the smaller number is used for the actual number of 
iterations of the loop. 
5.
Close the VI and do not save changes. 
End of Activity 14-2.
Using Array Functions
G has many functions to manipulate arrays located in Functions»Array
These functions include Replace Array Element, Search 1D Array, 
Sort 1D Array, Reverse 1D Array, and Multiply Array Elements. 
For more information about arrays and the array functions available, 
refer to Chapter 14, Array and Cluster Controls and Indicators, in the 
G Programming Reference Manual or Online Reference»Function and 
VI Reference
.
Build Array