LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenation of multiple states into single state in state machine

Hello All,

I have a AVI Video file consisting of total 900 Frames and I divide the whole video into subsections according to the frame numbers. This is done by using state machine with 4 states where each state runs after selecting the corresponding boolean buttons  such as:

State 1: runs from 0-200

State 2: runs from 201-500

State 3: runs from 501-899

State 4 (default): runs from 0-899 (whole video file)

Next I have to concatenate states 1, 2 and 3 by clicking all the corresponding 3 boolean buttons such that it runs the whole video file ie. first runs the state 1,then statev2 and finally state 3. 

Can anyone suggest how to concatenate multiple cases in a state machine to get a single output by combing all those multiple states

0 Kudos
Message 1 of 4
(2,732 Views)

1. Since it looks like your 3 states are identical, I would turn that code into a subVI.  You can then easily chain your VIs in sequence or in a FOR loop.

2. From what I see, I actually think the state machine is too much.  You can do everything I have seen with a simple loop and event structure.  Just be a little smarter with your UI (disable buttons when you can't use them for example) and this can be simplified quite a bit.


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 2 of 4
(2,715 Views)

@crossrulz wrote:

1. Since it looks like your 3 states are identical, I would turn that code into a subVI.  You can then easily chain your VIs in sequence or in a FOR loop.

2. From what I see, I actually think the state machine is too much.  You can do everything I have seen with a simple loop and event structure.  Just be a little smarter with your UI (disable buttons when you can't use them for example) and this can be simplified quite a bit.


1. I don't want to keep the states in a pre defined/fixed sequence because the user should be able to choose and run any of the 4 states at any point of time in the VI's execution. Also. each state have it's individual desired Frame rate, end frame, no of times to play video etc as shown in the attached image.

2. I have used the state machine only for the programming flexibility i.e later while programming, the programmer can easily change the order of state execution. This is done in view of future modification of the program.

0 Kudos
Message 3 of 4
(2,696 Views)

1. You can have inputs to a subVI that you pass in.  That is where you set your frame rate, end frame, etc.  Code for reuse and make your life A LOT easier.

2. It is still press button, do something.  You cannot do anything else while you are in one of those states anyways.  So might as well consolidate.


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 4 of 4
(2,680 Views)