08-17-2009 09:23 PM
Hello.
I have created a VI for my experiment and am having problem passing data outside a while loop to save on an excel file. The VI needs to first move a probe radially, take data at 1mm increment, then move axially, take data radially at 1mm increment, then move to the next axial position and repeat. It would then export these data to an excel file. The VI is a little complicated but it's the only way I know how to make it for our experiment. I have tested it and all the motion works correctly, however I can not get it to pass the data after the last while loop on the far right of the VI where I have put the arrows (Please see the attached VI ). Is it because I'm using too many sequence, case, and while loops? If so, what other ways can I use to make it export data to the excel file?
Any help would be appreciated.
Thank you,
Max
08-17-2009 09:59 PM - edited 08-17-2009 10:00 PM
Ummmm .... gee, I'm not even sure where to begin with this one. Your VI is well .... ummmm... You have straight wires! That's always nice to see. As for everything else. Well... Your fundamental problem is lack of understanding of dataflow programming. What you've created is a text program. It would look fantastic in C. In LabVIEW it makes my heart break. For a direct answer to your question: Data will not show up outside a while loop until the while loop has completed. This means your most likely problem is that the conditions to stop that specific loop are not being met. As for what the problem is, I don't even want to start debugging this code. Of course, one way to pass data outside of loops is with local variables, and hey, you seem to be having so much fun with those, what's one more?
This may sound harsh, and perhaps be somewhat insulting, but the brutal truth is that what I would personally do is to throw it out and to start using a good architecture like a state machine. This kind of framework is easy to code, easy to modify, and easy to debug. All qualities that your code seems to lack.
08-18-2009 12:41 AM
08-18-2009 01:48 AM
08-18-2009 05:40 PM
I think what is happening is the data that you are passing through your while loop at the end will be whatever the last value of that array is in the last iteration of your code. Auto indexing or a properly placed shift register MIGHT clear some of the problem.
08-18-2009 06:02 PM
If the loop finishes with the FALSE case, as would happen if the condition of the "final axial position" is met, you write an empty array to the tunnel, and that's what will exit the while loop.
(Just curious, why are some of your orange wires EXT? Look at all the coercions!)