LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional auto-indexing

Auto-indexing of arrays in for and while loops are a nice luxury in LabView.  One option that could save much time would be a menu option to turn on conditional indexing, this would expose a boolean terminal under the auto-index icon to select if the current itteration should add the itteration to the array or skip it.  From an execution standpoint there would only be a minor performance hit (could still preallocate max array size on for loops and automatically return used subset).  This could also work for autoindexed in but would have less use that the autoindeded out case.  I know I have built many conditional arrays inside of a for loop and it requires a case selection and a build array making the code less readable and requires time and thought.  It can also be less efficient than a compiler can do.

 

See the example below which would run a for loop and only build array of < 0.1

 

Conditional autoindex.jpg

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
21 Comments
Active Participant

Great idea!  BTW, there's already an OpenG VI called Conditional_Auto-Indexing_Tunnel that does this:

 

 

This polymorphic VI filters Array In by keeping only those elements where corresponding elements in Elements to Keep are TRUE. 

JKI Blog
Trusted Enthusiast

Thanks Jim 

I actually use this vi sometimesI usually just drop a shift reg and a case statement around the build arrayDoes the openg handle polymorphism or is this vi only for double floatsI have always wanted to write vis that would adapt to source like the build array functions do but my attempt to follow xNodes was a complete failureIf ni builds this functionality in I wouldnt have to clog up my loops with extra shift registers and unnecessary logicThe labview compiler should also be able to really optomize the code over the build array since the upper bound of the array out (for loop size).

 

Also We could probably bundle this feature with tst suggestion of allowing concatinate arrays on auto-indexing outThen all shift registers and pre-allocating array types would be gone from our code

For backwards compatibility saving these vis in old versions should return the build array and shift register approach.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Active Participant

Hi falkpl,

 

Yes the OpenG  Conditional Auto-Indexing Tunnel is polymorphic, but could definitely use some kind of better type adaption like LabVIEW's native polymorphism.

 

Cheers,

JKI Blog
Member
Perhaps you could also switch the location of the boolean input (below or above the terminal), or have some other means of indicating concatenation before or after the current array.
Member
This is a great idea!  We have countless places that would be hugely cleaner with this feature.  And it would probably improve performance, too.
Member

What a great idea, but it is not yours! Almost the same example.

 

May 2008: http://lavag.org/topic/7574-conditional-append/page__p__44719&#entry44719 

 

Anyway, i want NI to implement this, so i click Kudos! 

Proven Zealot
Great idea and i suppose it will make it perform better as well..
Member
I applied Kudos to this thread and cross-posted comments to another version of the same thing.
Knight of NI

I'm sure most people have implemented their own workarounds for a similar solution.

It would be great to have this feature in LabVIEW. 

 

Kudos!

______________________________________________________________________
Active Participant

Yes, I often use the openg version.  Having it built into LV would be awesome!