ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

if statement

Hi everyone!
 
I'd like to do following statements in Labview.
 
if a=0.001
then b=0
        c=1
        d=2
        e=3
        f=4
else if a=0.002
then b=5
        c=6
        d=7
        e=8
        f=9
end if
 
Thanks!
0 Kudos
Message 1 of 8
(3,715 Views)

What should happen if "a" is something else (not 0.001 or 0.002)?

 

Typically, you would use a case structure. Try it!

 

Of course you need to be very careful comparing floating point values. Whree does the "a" data come from?

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

Hope this is what you are looking for.

 

Run the VI and change the value of a.

 

 

Thanks

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 8
(3,704 Views)

Ranjeet_Singh wrote:

Run the VI and change the value of a.


(You might want to add a small wait to that loop.)

 

Here's an alternative version using arrays.

0 Kudos
Message 4 of 8
(3,692 Views)

Sir 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 8
(3,680 Views)

@Ranjeet_Singh wrote:

 

                           How you changed the controls and indicator. Never saw like this before.


If your create a front panet using 'Silver Controls' (and of course indicators) and downgrade it to any LabVIEW version lower than 2011. You'll see the same.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 6 of 8
(3,665 Views)

friend,

                            Looks like some kind of magic for me. 

 

Thanks

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 8
(3,661 Views)

Yes, I started out with your code (which was silver style), but downconverted, because the OP did not say what LabVIEW version he has.

0 Kudos
Message 8 of 8
(3,635 Views)