LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not pass data after while loop

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

0 Kudos
Message 1 of 6
(3,965 Views)

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.

Message Edited by smercurio_fc on 08-17-2009 10:00 PM
Message 2 of 6
(3,947 Views)
Heh well I'm used to programming in C and perl, not labview. The while loop executed completely because it does write to the file, but it's not the entire set of data, only some of it. I also tried to use local variables before and it still did the same thing.
0 Kudos
Message 3 of 6
(3,930 Views)
The VI is broken for me so I can't really debug. But I'm very curious as to what happens if you do a "enable indexing" on the problematic tunnel...? And yeah, this is a tough nut to debug and crack. Smiley Wink
0 Kudos
Message 4 of 6
(3,919 Views)

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.

 

0 Kudos
Message 5 of 6
(3,885 Views)

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!)

 

 

0 Kudos
Message 6 of 6
(3,880 Views)