LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving data

The program I have currently prompts the user to create a new file whenever the run button is hit, and then all the data goes to that file. It is a measurement file. What I would like for the program to do is to be able to run constantly, and have a button on the front panel that allows the user to save certain amounts of data. To be more specific the button would let the user tell the program when to begin acquiring the data. And there would be a box that lets the user choose the file name, as to where to save the data. And there would be a stop button, so the program itself would continue to run, but data would no longer be going to that file. And then for the user to have the option of once again beginning to acquire data and placing into a different file (without loosing the data previously taken). How should I go about this?
0 Kudos
Message 1 of 7
(3,974 Views)
Take advantage of the "Enable" and "Reset" inputs to the "Write to Measurement File" express VI.  I haven't looked too carefully at your VI and in general I don't use Express VIs, but it looks like you could turn off the "Enable" input when you want to stop logging, then set the "Reset" input to true once when you start logging to force it to prompt for a new filename.  You'll probably need a shift register in your while loop to track whether or not logging is currently in progress.
Message 2 of 7
(3,946 Views)

You can add a boolien switch to the enable function of the wright to file. So when the button is pressed it records but when you press it again it stops. If you right click on the Wright to measurment file in the block diagram you can set it to request a new filename everytime it is enabled by pressing save to one file the tick the "ask user to choose file name"

 

Hope that helps

0 Kudos
Message 3 of 7
(3,941 Views)
I added a "button" for enable, and set it so you can see the file name. But now the enable and and saving? Buttons flash while the program is running and it only calls for one file name at the beginning, and I want to be able to save multiple files without stopping the program. It doesn't let you push the buttons while the program is running, the lights just flash. Any suggestions?
0 Kudos
Message 4 of 7
(3,929 Views)
Without your revised code it's hard to guess what's happening.  It sounds like you may have confused a control with an indicator when you created the Enable button if you can't set it while the program is running.  Setting the "Reset" input for one loop iteration should allow you to choose a new filename when you restart logging.  You may want to spend some time debugging your code with execution highlighting enabled (clicked the lightbulb icon in the toolbar) so you can see what's happening and why.
Message 5 of 7
(3,926 Views)
I have a button that resets the write to measure file, but when you click to reset it them prompts you to keep saving the file forever-more. I want to be able to reset, and have it prompt you to be able to save data, but not constantly saving data. I want the user to be able to stop saving the data, and then restart saving (but not at the same second they stopped saving data). I want the user to be able to choose which data they are collecting. 
0 Kudos
Message 6 of 7
(3,917 Views)

I'm going to guess that your "Saving..." light is flashing on and off because you're flipping on and off the Enable switch due to your threshhold.  You're logging data only when it's over your limit, and the signal is probably alternately above and below that limit, causing logging to start and stop.

 

You've used a button with a "Switch" action for "Reset."  This means that you're providing a TRUE signal to Reset every time through the loop, causing it to reset and prompt you for a new file name each loop iteration.  Instead, set the Reset signal to TRUE only once each time you restart logging.  You could accomplish this by setting the mechanical action on your Reset button to "Latch when released."  A better way to do it would be to add a shift register that tracks whether you're currently saving data.  If data was not being saved on the previous iteration, but it is on the current one, then set the Reset input to true for that iteration.  If you don't understand this, spend a bit more time learning LabVIEW, and experiment with shift registers.

 

There's a lot of room to simplify your program.  For example, you can replace this:

original

with this:

 

simplified

 

If you are just uploading a single VI, please try to attach only that file rather than a ZIP archive.

Message Edited by nathand on 09-17-2008 03:19 PM
Download All
Message 7 of 7
(3,896 Views)