LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
jdunham

Index Array with required inputs

Status: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.

The Index Array function should have an option (possibly default) to require that the index be wired. Forgetting to wire it up is a very common source of bugs and it's hard to find.  The autoincrementing feature when you grow this function is cool and should be preserved, but 95% of the time, I need to have the index wired in.
4 Comments
Darren
Proven Zealot

I think I probably leave indices unwired on Index Array more than I wire them, not only for the ease-of-use with incrementing the indexed items, but also for pulling out entire rows/columns of 2D arrays.  If an option like this does get added, I would argue that it should *not* be default.

 

An alternative could be a VI Analyzer test that flags Index Array functions with the index unwired...we could have it default to only checking 1D arrays.

 

-D

jdunham
Member

Well if you only want the column you *have* to wire the input, and if you want to get the first scalar element of a 2D array you also have to wire both index inputs.  So for 2D arrays the only default you get is row=0, and I think losing that would be a small price to pay for a lot fewer self-inflicted bugs.  Rather than an option, it might be simpler to require the first index input to be wired and only subsequent (autoincremented) index inputs are optional.

 

Anyway, Thanks for responding!

Albert.Geven
Trusted Enthusiast

But make really sure that when upgrading to that version of LabVIEW, all not connected constants are generated and especially the zero's are placed on the subvi to prevent unreadble vi's that were nicely layout when no constants where present.

 

I Also would like an option to turn on, range checking on array indexing!

Especially beginners (or students) need such option.

I agree that the check costs time but finding indexing errors costs more when developing.

greetings from the Netherlands
Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.