10-27-2011 12:47 PM
My vi is set to read an external file (a previously collected force plate signal), then perform a string of analyses on it and finally save the analytical output. Currently, "Read from measurement file" is outside the while loop containing all of my analysis.
Without completely restarting the vi, I would like to be able to release the file and load another. How might I do this?
Thanks!
10-27-2011 02:31 PM
I think you need to put one loop inside another loop. The inner loop does the analysis and saves the output. It sounds like you already have that working.
The outer loop provides the inner loop with a fresh set of data each time.
It would be easier if we could see your program.
10-27-2011 04:04 PM
Attached to this post is the program I have so far.
When started, the program prompts the user to enter the linear scaling equation for the signal from the force plate, as well as prompting the user to choose the signal file. I would like to enter the scaling equation, then analyze a file, save the output, then analyze another file without having to enter the scaling equation again.
10-27-2011 06:21 PM
The first thing I'd like to mention is that in 15 years of Labview programming, I've never once made a program with a block diagram bigger than one screen. (I'm sure there are many other things I do wrong, but I think clean, neat code is important.) Yours definitely isn't the worst I've seen... but I really hope you clean it up.
I haven't checked carefully, but it looks to me that the only thing you have to do is move "Read Measurements File" from outside the loop to inside the loop. If it's inside the loop, it gets called every time the loop runs, so a new measurement file gets selected each time.
Leave the equation input outside of the loop. That way, it only runs once, before the loop starts so the operator doesn't have to enter the equation again.
Let me know if that doesn't work.
10-28-2011 11:31 AM
It looks like the solution is a slight modification of the first one suggested. I created a second while loop around the while loop in the original program I posted, with the "Read from measurement vi inside of the outer loop, but outside of the inner loop. I wired the "EOF?" output to the "Reopen File" input. When the inner while loop finishes, the "read from measurement file" vi reaches the end of the file, prompting the open file dialog again.
Thanks for the help!
As a follow up question to LandBelenky, how would you suggest that I clean up the program? I had assumed that the program would be necessarily complex, as the final analysis has a total of 66 outputs, each of which has a different calculation.
10-28-2011 03:14 PM
I would do several things to clean up the block diagram.
The attached VI shows two ways of doing something. On the left is your code, which is four sets of the same thing. On the right, I've taken this code and put it into a loop so it does the same thing four times.
10-29-2011 08:50 AM
Can you make that vi into a 2010 labview file? I can't open the one you attached. Thanks!
10-31-2011 10:14 AM
Hey Georgebb,
Those are some great suggestions by LandBelenky! SubVIs are a great way to keep your code maintainable and easier to follow.
I made a 2010 version of his example file for you.
Hope it helps! let us know if you have any more questions!
Joe S
Applications Engineer
National Instruments
10-31-2011 10:37 AM
Sorry, I keep forgetting that I'm using LabView 2011.