01-16-2018 05:55 AM - edited 01-16-2018 05:56 AM
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
01-16-2018 06:40 AM
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.
01-16-2018 07:40 AM - edited 01-16-2018 07:41 AM
@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.
01-16-2018 08:08 AM
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.