LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add or delete from array base on a condition

Hi

I would like to add an element to an array if a condition is true.

For example in the attached picture, I would like to add one entry to array when the first element is yes, but I would like to add nothing if the first element is not yes

could you please let me know what should I add to false structure to not add any entry to array. I see if I use defualt value or defualt constant it still adds 0,0 to array 

0 Kudos
Message 1 of 6
(3,066 Views)

do you have LV2013?

 

If so, you can use the new conditional tunnel output:

 

https://www.ni.com/docs/en-US/bundle/labview/page/conditionally-writing-values-to-loop-output-tunnel...

http://www.medicollector.com
0 Kudos
Message 2 of 6
(3,051 Views)

@josborne wrote:

do you have LV2013?

 

If so, you can use the new conditional tunnel output:

 

https://www.ni.com/docs/en-US/bundle/labview/page/conditionally-writing-values-to-loop-output-tunnel...


This is present in 2012 also.
Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 6
(3,043 Views)

The conditional indexing came out with LabVIEW 2012.  That is the easy way.  If you are using older, then you need to use a shift register to hold your growing array with a Build Array inside of a case structure.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,039 Views)

I was too slow...

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 6
(3,034 Views)

@crossrulz wrote:

The conditional indexing came out with LabVIEW 2012.  That is the easy way.  If you are using older, then you need to use a shift register to hold your growing array with a Build Array inside of a case structure.


Move that equals outside the loop (the optimizer probably does it anyway but, we should point out equals works with arrays)

!0.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(3,019 Views)