LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save/writing data continuously

Hi,

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.

Anybody can help me?...

Thanks

Zai
0 Kudos
Message 1 of 7
(4,140 Views)
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:506500000008000000492D0000-1002247793000@exchange.ni.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.
0 Kudos
Message 2 of 7
(4,140 Views)
Hi Zai,
choose one of these two VIs (the second one seems to be what you're looking for). Also, you can improve the open file dialog call with some more parameters (like start path ...)
Good luck !
Download All
0 Kudos
Message 3 of 7
(4,140 Views)
I attach a slightly different solution including how to put stuff into a file. Change the file generation interval to suit your application and include your own data acquisition code.

Let me know if it helps.

Regards, Richard.
0 Kudos
Message 4 of 7
(4,140 Views)
Hi Richard,

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 attached both vis for you to look at.

TQ
Download All
0 Kudos
Message 6 of 7
(4,140 Views)
Hi TQ,

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.

Richard.
0 Kudos
Message 7 of 7
(4,140 Views)
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,

Dave.


>
0 Kudos
Message 5 of 7
(4,140 Views)