I'm trying to save/write data continuously at certain time interval (eg. every half an hour or every hour) but couldn't get exactly what I want.
If I put my write.vi in the data acquisition loop... the dialogue box keeps on asking for a new filename...
If I put them outside of the loop... it will ask for the file name only after I stop the acquisition...
What I really wants actually are... the dialogue box to ask for a filename only once (when I start running the vi) and it will save/write the data every half an hour (in a different filename if possible .. eg. test1.. test2.. test3.. ) until we stop the data acquisition.
You can pass a filename to the "write" VI I believe. The "File Dialogue" VI is available in the File palette- perhaps in the "Advanced" sub-palette. Simply run the dialogue before the loop to get the file name and pass this file name to the write function, which will then not prompt each time.
zai wrote in message news:506500000008000000492D0000email@example.com...
> What I really wants actually are... the dialogue box to ask for a > filename only once (when I start running the vi) and it will > save/write the data every half an hour (in a different filename if > possible .. eg. test1.. test2.. test3.. ) until we stop the data > acquisition.
Thanks for your example. It's really what I'm looking for. I'd tried your examples (with minor modification) on it's own and it works as it should be, where, the files are saved on the time intervals specified. However, when I combined your vi with my data acquisition vi the file saving will not works until I stop the data acquisition. I think it has something to do with the different loops but I'm not sure how to correct it. Could you or anyone please help me to solve this problem.
I've had a quick look at your save_mat VI. Yes, I think you need to combine your loops. My first impression is that you need to collect data (waveform/array-building) and create a string within my opening and closing files loop. Your string would be written to the file with or instead of my time/date string (see comment "Create a line of text" in the VI). It may be clearer if you think about the sequence of events in the program: (Initialise?) A file base name must be generated and your data acquisition hardware must be set up; (Data collection / file writing loop?) A file must be created using the base name and data acquired once; This data must be written into the file; The program must have a half-hour pause and then repeat. Well, that's how I would do it. Hope it helps.
Hi, if you want a different filename then you'll have to build a path on the fly. The Build Path function would allow you to specify a base path and append a string to this (which could be built from the index count of a loop).
File VI's will prompt for a path if you don't give them one.
Also beware of writing to an existing file (say if you run the prog. again the files may already exist). Otherwise Labview will prompt for overwrite. The best way round this is to delete the file (whether it exists or not) before you try to write (use the delete function). Regards,