LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

automatic store data in a different directory after each sampling

Hi, all:

I am a novice, here is my question.

I need to make some modification on the program developed by others. The
original code just realize a DAQ and then conduct some signal analysis,
after that, store the data into several files. but the deficiency of the
original code is that we push a button, then sampling once and pop up a
dialogue to ask us where we want to store our data.If you want to make
another measurement, you should push the button again.

Now I want to automate this process. When I push the button, then it will
sampling once automatically every several seconds, and don't popup a
dialogue to ask where to store the data, but store the data automatically,
but I have a requirement, each t
ime when the program store the data, it
should be stored in a different directory.

Thanks

--
Guohua
0 Kudos
Message 1 of 4
(3,060 Views)
Check the program, and see where the file is written. At this point wire a shift register into the path, and use some kind of logic (add the loop number to the path) to change the name. In the shift register initialization, you can set a file dialog to first select the archive name (the first one, then it will change) or wire a constant.
Hope this helps
0 Kudos
Message 2 of 4
(3,060 Views)
You can use the "List Directory" vi to obtain string arrays with the files and directories names inside a specified directory. The arrays already return the names in alphabetical order, so the selection of the directory or file is simplified.

In case you need to create directories programatically, you can use the "New Directory" vi.

Both vi's are located in the functions palette:

File I/O -> Advance File Functions

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 3 of 4
(3,060 Views)
Guohua,

CONTINUOUS SAMPLING:
You may find several examples on continuous sampling in LabVIEW. Look under HELP-Contents & Index-I/O Interfaces-DAQ-Analog Input-Continous Analog Input-Continuous Acquisition & Chart (Buffered). The AI Read is inside a WHILE loop, which allows the data to be acquired continuously until you stop it.

SAVING DATA:
You need to use the Open/Create/Replace File.VI found under the File I/O function palette. Make sure you chose "CREATE" as the function. You can do this by using the Wiring Tool, right clicking on the Function input, and selecting Create-Constant. Then use the Operate Value (the hand) to change the value from "Open" to "Create". Continue with your Read/Write to File VIs as well as the Close.VI. Put these VIs inside a W
HILE loop. Each time the loop executes, it will create a new file. You might consider putting a time delay inside the loop as well to ensure that timing does not become an issue.

You may see other examples if you look in c:\Program Files\National Instruments\LabVIEW6\examples or under the HELP menu in LabVIEW.

Best Regards,
Lee Anne Gaspard
0 Kudos
Message 4 of 4
(3,060 Views)