LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

switch case like C

Solved!
Go to solution

Hi all,

          Is it possible to use loop like switch case in C. Suppose one of my process generate numbers, like 1,2 ,3 4 n all, so if it generates 2 I want to perform task mentioned in event 3, if 2 then it should perform task mentioned in event 2. Please help me in this issue

0 Kudos
Message 1 of 14
(3,186 Views)

sounds like state machineSmiley Wink

0 Kudos
Message 2 of 14
(3,185 Views)

Use event structure

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

@Omi_30 wrote:

Hi all,

          Is it possible to use loop like switch case in C. Suppose one of my process generate numbers, like 1,2 ,3 4 n all, so if it generates 2 I want to perform task mentioned in event 3, if 2 then it should perform task mentioned in event 2. Please help me in this issue


2 - 2

3 - 3

 

Do you want for 2 for 2 and 3 for 3? 

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

Thanks for the reply.

 But in event structure it is accepting with Button only. When tried with Button (Value Change), the proper event gets called, but when tried with Integer generated by process, then it is not working, Can you get some example.

0 Kudos
Message 5 of 14
(3,179 Views)

If one simple addition in previous step generate 2, then Event structure should execute task in Event 2..like this so on..so not getting how to handle the Event source as this generated integer

0 Kudos
Message 6 of 14
(3,177 Views)

like in C , if input to Switch case is Integer 2, the Case :2 will get executed.So same thing I want to do in LV.

But dont know how to use this integer as Event source in event structure. Did succefully event structure with buttons normal as taking Value change.

 

I am new to LV Smiley Surprised

0 Kudos
Message 7 of 14
(3,175 Views)
Solution
Accepted by Omi_30

Here

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

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

Learn State machine.

You can trigger events for numeric values also usind Value ( signaling ) property but state machine will be better.

Make a decision in 1 state and based on the value switch to other states  

0 Kudos
Message 9 of 14
(3,167 Views)

Thanks a lot for the solution. Also is it possible to automate button pressing, suppose I am having one button but insted of user pressing that,can I controll the Button inside, using one Boolean?

0 Kudos
Message 10 of 14
(3,147 Views)