cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

retrieve iteration from stacked sequence structure

I have a stacked sequence structure with 15 iterations. Is there a functional equivalent to the "i" from the For loop or a way to make one?

 

I need to trigger some other events based on what iteration of the stacked sequence is running. 

0 Kudos
Mensagem 1 de 10
4.667Exibições

In a sequence structure they are called frames rather than iterations.  And you have run into one of the reasons why sequence structures are usually not the best arrchitecture for involved programs: They are hard to modify and essentially impossible to branch.

 

You can context-click on the edge of the frame and choose Replace with Case Structure.  Enclose the case structure in a while loop.  With just a little extra effort you will have a state machine which is much more flexible.

 

Lynn

Mensagem 2 de 10
4.661Exibições

Hi,

 

you can put numeric value 0 to case 0, then pass that value + 1 to next stack (right click the sequence structure, add sequence local). It would be better design to use state machine than sequence structure.

 

seq.png

Mensagem 3 de 10
4.655Exibições

Let me first reiterate what the others have said. Avoid stacked sequences like the plague!

 

I have found that except for very few situations there is always a better way then using a sequence structure.

 

That being said you could use a local variable to do this too...

========================
=== Engineer Ambiguously ===
========================
Mensagem 4 de 10
4.641Exibições

I've convinced myself it's better to use a proper state machine.

 

So to do this, the best method is to have 15 serparate case structures, and place that into a while loop with N=15?

 

..then read the iteration number, and depending on that logic, select the proper case structure within the while loop?

0 Kudos
Mensagem 5 de 10
4.633Exibições

@Synbios wrote:

I've convinced myself it's better to use a proper state machine.

 

So to do this, the best method is to have 15 serparate case structures, and place that into a while loop with N=15?

 

..then read the iteration number, and depending on that logic, select the proper case structure within the while loop?


That should be ONE case structure, containing 15 different cases.  Then you wire the iteration number directly to the ? terminal of the case structure.

Mensagem 6 de 10
4.629Exibições

That makes sense. thanks!

0 Kudos
Mensagem 7 de 10
4.626Exibições

May I humbly suggest this article: Application Design Patterns: State Machines

 

You can create a state machine using the VI template that ships with LabVIEW. File -> New... Then expand the "From Template" branch.

Mensagem 8 de 10
4.616Exibições

In your example though, how do you get the dark bolded local variables? Or the part of the first frame that says I32 Iteration.

0 Kudos
Mensagem 9 de 10
4.606Exibições

They're drawn that way automatically my setting the local variable to "read". With the addition of the little arrows (as a consequence of an idea submitted in the LabVIEW Idea Exchange) it's somewhat redundant now.

Mensagem 10 de 10
4.593Exibições