From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building array in a case structure how do to nothing during the other case?

Solved!
Go to solution

I have an array that is populated during the true section of a case structure. That part works fine. The issue I'm having is when the case is false, I do not want to add to the array at all, but since the array is moved outside of the case structure there is a tunnel. I'm not sure what do add to the false case, so the array does not get populated. 

0 Kudos
Message 1 of 7
(3,776 Views)
Solution
Accepted by LiliMcDonald

If you attached your VI (or at least the part with the Case Statement), we could quickly/easily answer it.  The "best answer" depends both on what you are doing and on which LabVIEW Version you are using -- we can tell both by looking at your VI (but it has to be an actual .VI file, not an image of part of the Block Diagram).

 

If you tunnel in from the left and tunnel out to the right, simply wire from Input to Output in the False case and Do Nothing.  If you are generating values inside the loop and only want to generate in the True Case, you put the Case statement around the Build Array and follow the previous suggestion.  Or, if you have a fairly recent (I think since 2013 or maybe a year or two earlier) version of LabVIEW, you can select the Indexing Output tunnel and make it a Conditional tunnel -- wire your True/False to the "?" terminal and the value will be Appended to the Array only when the Conditional is True.  Much simpler/neater than using Build Array.

 

Bob Schor

Message 2 of 7
(3,767 Views)

 

Just use shift registers for your array.  Wire straight through in your FALSE case and the array wraps around to the beginning of the loop unaltered.  I believe you said you already conquered the TRUE case?

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 7
(3,767 Views)

@Bob_Schor wrote:

If you attached your VI (or at least the part with the Case Statement), we could quickly/easily answer it.  The "best answer" depends both on what you are doing and on which LabVIEW Version you are using -- we can tell both by looking at your VI (but it has to be an actual .VI file, not an image of part of the Block Diagram).

 

If you tunnel in from the left and tunnel out to the right, simply wire from Input to Output in the False case and Do Nothing.  If you are generating values inside the loop and only want to generate in the True Case, you put the Case statement around the Build Array and follow the previous suggestion.  Or, if you have a fairly recent (I think since 2013 or maybe a year or two earlier) version of LabVIEW, you can select the Indexing Output tunnel and make it a Conditional tunnel -- wire your True/False to the "?" terminal and the value will be Appended to the Array only when the Conditional is True.  Much simpler/neater than using Build Array.

 

Bob Schor


Good post.  I just strictly limited myself to the given scope of the issue.  😉

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 4 of 7
(3,763 Views)

Or, if you have a fairly recent (I think since 2013 or maybe a year or two earlier) version of LabVIEW, you can select the Indexing Output tunnel and make it a Conditional tunnel -- wire your True/False to the "?" terminal and the value will be Appended to the Array only when the Conditional is True.  Much simpler/neater than using Build Array.

 

That is exactly what I needed thank you!

Message 5 of 7
(3,749 Views)

NoNoNo... if anything mark Bob's solution as the real one.  (I don't even think my comment deserves a solution checkmark, even though you can have multiple posts marked as such.)

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 6 of 7
(3,746 Views)

Haha that was my bad. I meant to accept his, but didn't look that closely and saw the quoted text and thought it was his post.

0 Kudos
Message 7 of 7
(3,737 Views)