LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Getting data out of while or for loops in Stacked Sequence Structure after each iteration

I want the data out of while or for loops in Stacked Sequence Structure after each iteration..

I want the data out of loops even if it is not stopped that is after each iteration.. to see the plot of data at each iteration and continue to the next loop in the same plot.

 

somebody please help me ..

I want to send and get data from a device, the data will be plot each time.

thanks..

 

0 Kudos
Message 1 of 3
(431 Views)

Check out this Nugget about Action Engines.

 

There are other approaches as well for example queues, user events, channel wires but the Action Engine is an age old method, that can be adapted and is quite easy to understand and implement.

 

Have fun!

 

Ben

0 Kudos
Message 2 of 3
(413 Views)

Instead of using a Stacked Sequence (which, as you are discovering, is extremely messy, doesn't scale well (suppose you needed 15 instead of 3 identical processes), and no longer appears on the Structure Palette (at least not in LabVIEW 2016) (though it is still available), why not use an outer For loop with 3 wired to N?  If you want to "see" values inside the loop as it executes, don't use an Indicator (when the loop runs very fast, you won't see anything anyway) but use a Probe instead.  Instead of using a Shift Register to build your array, just use an indexing output tunnel.  You'd do this twice -- first on your inner For loop (that creates each of the three Arrays), then on the new "surrounding" For Loop to (in one step) create the 2D array that you want.  To do this 15 times, wire 15 to the outer For loop!  Much simpler, much less likely to make a mistake.

 

If you want to "see" data as it is being created, you need your graph to be "inside" a loop.  I'm not quite sure what you want to see -- do you want to see point-by-point plot of Iteration 1, then point-by-point plot of Iteration 2, then point-by-point plot of Iteration 3, all on a single Chart that "starts over" with each iteration?  Try the following -- inside the outer (N=3) For Loop, first clear the Chart.  [You want a Chart, not a Graph, for this demo, as you'll be putting individual points on it and want to "see them appear"].  In the inner loop, as you generate a point, send it to the Chart -- this will plot all the points as they are generated.  When the inner loop ends, the Chart will be complete.  When the next Iteration starts, the Chart will (again) be cleared and the next points will be plotted.

 

You'll notice I'm not providing a Block Diagram.  You should be able to generate it yourself (and will learn a whole lot more that way).  If there's something you don't understand, use the LabVIEW Help or review the Tutorials (see the first page of this Forum) that talk about For Loops, Arrays, and Indexing Tunnels.

 

Bob Schor

0 Kudos
Message 3 of 3
(384 Views)