LabVIEW Idea Exchange

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

Putting a NIL element into an indexing loop output

As far as I know I always need a shift register when I build an array in a loop depending on a certain condition.

In the example below I create 100 random numbers and want to collect only the results > 0.5 in an array.

 

The upper block diagram shows the current solution with a shift register.

If the condition is true, the result is added to the array.

If the condition is false, the array remains unchanged.

 

My proposal is a NIL element, which can be put into an indexing loop output but adds nothing to the array.

The NIL element should be able to auto-select it's data type when it gets connected.

With such a NIL element the outcome of both VIs should be the same.

 

nil_to_array2.png

 

Kind regards,

Dietmar

3 Comments
Technico
Member

Are you perhaps looking for Conditional-auto-indexing:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Conditional-auto-indexing/idi-p/918682 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Conditional-Append-quot-at-array-indexing-tunnel/...

 

Or do you really want a NIL-element?

Do you have examples for other uses outside a loop?

schuller
Member

I wasn't aware of the conditional-auto indexing proposal, thank you.

It's almost scary that your second link shows exactly the same example, I swear I didn't know it before.

 

I think my idea is a different solution proposal for the same problem.

But maybe a NIL element is also useful in other situations, I haven't thought about that.

Darren
Proven Zealot