MORECHEMISTRY.COM::MORE CHEMISTRY ON THE WEB |
Home | Member Area | Links | Events | Publications | Promotions |
#GOOGLELINKS# |
LabVIEW programming topics - arrays and loops
[LabVIEW vi collection]
[LabVIEW links]
[LabVIEW store]
[programming topics] [drivers] [utilities] [projects] [events] [related topics]
Using arrays (3)This vi demonstrates how arrays can be manipulated with For Loops.
If a 1-dimensional array is connected to a 'for loop' then auto-indexing is
on by default. The 'for loop' will treat the elements of the array one at
the time. If you want to do some calculation on all the individual elements of the
array it is okay to leave the N (number of iterations) unwired. Here are some cases of supplying an 8 element array as input to a 'for loop'.
case 1 - Auto-indexing is on, the scalar NumericValue 1 will be updated 4 times if Loopsize is 4 or 8 times if Loopsize is 12. The intermediate values will be visible. case 2 - Auto-indexing is on, the scalar NumericValue 2 will be updated 4 times if Loopsize is 4 or 8 times if Loopsize is 12. The intermediate values will not be visible. case 3 - Auto-indexing is on, the 1-dimensional array Array 1 will contain 4 elements if Loopsize is 4 or 8 elements if Loopsize is 12. The intermediate values will not be visible. case 4 - Auto-indexing is off, the 1-dimensional array Array 2 will be recalculated, in its entirety, 4 times if Loopsize is 4 or 8 times if Loopsize is 12. The intermediate values will be visible. case 5 - Auto-indexing is off, the 1-dimensional array Array 3 will be recalculated, in its entirety, 4 times if Loopsize is 4 or 8 times if Loopsize is 12. The intermediate values will not be visible. case 6 - Auto-indexing is off, the 2-dimensional array Array 4 will be recalculated, in its entirety, 4 times if Loopsize is 4 or 8 times if Loopsize is 12. The intermediate values will not be visible. Apparently turning auto-indexing on for 'inputs' will result in values of 1 dimension less whereas turning auto-indexing on for 'outputs' will result in values of 1 dimension more. Turning auto-indexing off will leave the dimension unaltered.
Downloadsarray-loops.viThe vi as described in the text.
See also...- How to intialize and change the elements of an array.- How to do basic array calculations. Bart Boshuizen, 2005/03/08
|
#GOOGLEDISPLAY#
|