01-09-2012 11:43 PM
hi,
In my project i am using a while loop in which i have a stacked sequence,in one frame of the stacked sequence i get a max index value from array max and min function, based on that output value i am using a sequence local to send this output index to another frame in stacked sequence. In other frame of stacked sequence iam using a case structure with sequence local attached to it. But i am unable to go to the correct outputted value coming out from one frame to another. Can anyone guide me in this
01-10-2012 12:57 AM
It is hard to help you with your specific problem without a screenshot or a copy of your .vi posted.
But you'd be better off not using a stacked sequence anyway. Stacked sequences hide code, and cause wires to run from right to left whenever you use sequence locals. So just avoid them.
Right click on the frame of your stacked sequence and pick Replace with Flat Sequence. You might even find out that you don't need to use a sequence structure at all, or possibly could merge some frames of the sequence.
There are only a few situations in LabVIEW where flat sequence structures are useful or necessary. In the vast majority of cases, proper use of error wires will allow you to enforce the proper flow of data entirely with wires.
01-10-2012 11:00 PM
I would also like to add that I only use sequence (flat, never stacked) structures for code that can't be forced to follow the dataflow paradigm, such as FGVs (but I suppose I could force these as well, but typically don't)
01-11-2012 01:08 AM
hi,
Thank you for the intrest. Reason for using stacked sequence is,in my project i need to autofocus an image. For that process,i am taking a while loop in which i am taking one set of steps to take the focus score,get the highest focus score at that particular index and again go 2 steps in that particular directions and again the process continues,
so i need to get back every time till i attain the highest focus score. I tried many procedures and thought that would be the best and implemented it. If there are any other procedures can u guide me further
01-11-2012 06:08 AM
Sounds to me like a race condition in the previous frame, causing you to send the wrong number forward. The structure variable cannot fail in itself. 🙂
Run the program in Highlight mode and Retain values and i'm sure you'll find the problem.
/Y
01-11-2012 06:21 AM
continued here - or just a plain double post?
01-11-2012 07:27 AM
A state machine would probably work for your application. It's much more efficient and gives you far more control.