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: 

Changing Variables in Case Structure?

Solved!
Go to solution

Hi all,

 

I have a case structure. Based on whether the case is t/f I would like to change the value of two variables. If I put the two variables in the true part of the case strcture they can't be in the false part. How would I assign them values outside of the case structure? Could I refer to them numeorus times in the different cases? Thanks.

0 Kudos
Message 1 of 8
(3,001 Views)

Couldn't you simply assign the values inside the structure, and put the variables outside to the right?

Im afraid im not 100% sure what you are asking.

 

Like this?Untitled.png

0 Kudos
Message 2 of 8
(2,998 Views)

lab.png

Here's the part of the code. Basically I have 4 values. I then compare two in order to determine which values to use. Should for example the value on left be greater, I want to write the two left values to a pair of vairables. Should the value on the right be greater I wish to write the two values on the right to the pair of vairables mentioned previously. I tried writing them in a case structure but I couldn't put the variables in both the true and false part of the case structure. 

0 Kudos
Message 3 of 8
(2,993 Views)

Bascially I would like to say in pseudo code if the four top values are w/x and y/z and the two new values are a/b

 

if w > y

a = w

b = x

if y > w

a = y

b = z

0 Kudos
Message 4 of 8
(2,981 Views)
Solution
Accepted by topic author JustinC

So something like this?


GCentral
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 5 of 8
(2,976 Views)

Yes! Exactly what I was looking for. Thnaks!

0 Kudos
Message 6 of 8
(2,971 Views)

Crap, crossrulz just barely beat me to it...

0 Kudos
Message 7 of 8
(2,966 Views)

@NateTheGreat wrote:

Crap, crossrulz just barely beat me to it...


Yeah, I'm having fun this week.  Altenbach normally just beats me.  But he's busy having fun at NI Week and so I manage to get solutions in.


GCentral
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 8 of 8
(2,964 Views)