LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to index array in a for loop

i'm connecting from variant-to-data function to an index array function inside a for_loop (refer to attachment).  the data-type wire got converted from Table(2-D array) to Table(1-D array).  How do I keep it from converting to 1-D array?
0 Kudos
Message 1 of 5
(10,046 Views)
You can disable the indexing rightclicking on the index node.
0 Kudos
Message 2 of 5
(10,043 Views)

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.



Message Edited by smercurio_fc on 03-31-2008 04:48 PM
0 Kudos
Message 3 of 5
(10,038 Views)
i got it, thanks.
0 Kudos
Message 4 of 5
(10,026 Views)
Of course it seems you want to run the loop once for each row in the 2D array, so many times autoindexing is the better solution!
 
You are using an "index array" inside the loop. If you are planning to wire the index to the iteration [i] terminal (who knows? :)), you might as well use autoindexing. This way you don't need to wire N (the loop will know how many rows there are) and you don't need to use index array inside the loop.
 
The image shows two functionally equivalent code fragments. Autoindexing (bottom) is much simpler than explicit indexing (top). See if autoindexing can work in your case.
 
 
Since you are a LabVIEW beginner, you should try to stay way from stacked sequences and local variables. They are rarely needed and can ofter cause problems such as race conditions and unreadable code.


Message Edited by altenbach on 03-31-2008 04:17 PM
0 Kudos
Message 5 of 5
(10,010 Views)