LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stacked sequence inside for loop question

Hi everyone,
I am new to LabVIEW and I just want to make a for loop with a stack sequence inside. I want it so that when the for loop executes for the n-th time, the stacked sequence is at the n-th frame (because each frame contains different tasks to be carried out). Is this possible? or is there an alternative equivalent method? Please help me out! Thanks!!
0 Kudos
Message 1 of 6
(3,055 Views)
Hi diishen,
like i understand it, you only need a case structure. Smiley Happy Connect the iteration counter to the case selector. This makes what you want.
Mike


Message Edited by MikeS81 on 05-30-2008 08:54 AM
0 Kudos
Message 2 of 6
(3,050 Views)
Hey Mike,
Thanks for the advice! So the case structure starts at the 0th case but does the for loop start at the 0th loop as well? (eg. if I want 4 loops, I should connect a "3" to the N terminal?)
0 Kudos
Message 3 of 6
(3,044 Views)

Hi diishen,

if you want 4 iterations, then you have to connect a 4, but the iteration counter starts with 0.

Mike

0 Kudos
Message 4 of 6
(3,042 Views)
I think that diishen is looking for a state machine....
You can find an example in the templatebrowser which you can open using File >> New (NOT New VI). You will find several different design patterns there.

To your initial question:
A stacked sequence will never work out for you in this case since every frame of the sequence is executed before iterating in the loop.

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 6
(3,038 Views)

Thank you Norbert for the words of advice.

Try to avoid Stacked Sequence Structures at all cost.  They are a nightmare to deal with when maintaining the code and they do not offer simple scalability, especially if you need to deal with parallelism.

As Norbert suggested, State Machines is the way to go.  Try to avoid naming covention such as 1...2...3...4...5.......9999.  Give the name of each case based on what that case does.  Create a TypeDef Control for the state selector (you'll thank me after having changed it for the 5th time 😉  ).

There are probably 100's of examples in this forum.

RayR

Message 6 of 6
(3,007 Views)