Jump to content


Photo
- - - - -

Saving Data To a File at Time Intervals


  • Please log in to reply
3 replies to this topic

#1 Michael Aivaliotis

Michael Aivaliotis

    MindFreak

  • JKI
  • 2,664 posts
  • Version:LabVIEW 2012
  • Since:1994

Posted 30 June 2004 - 08:26 PM

How about putting the file saving code inside of a loop with a timed delay? If you give a little more description of what you are using already then I can respond with more information.
Thank You
Michael Aivaliotis

VI Shots

#2 Paul

Paul

    Active

  • Members
  • Pip
  • 22 posts

Posted 29 June 2004 - 12:41 PM

I was wondering if anyone knows how to specificy a user control for saving data to a file every x seconds. It currently does it every 1.7-2 seconds. I was wondering if there was a setting or a control that I am having some trouble finding.

Thanks

Paul

#3 Paul

Paul

    Active

  • Members
  • Pip
  • 22 posts

Posted 01 July 2004 - 11:59 AM

I did that and it works. However the fastest that data can be saved is every .3 seconds. Is that because that's the fastest that the data is received from the insturment or is that a coding error? Any ideas?

#4 Bryan

Bryan

    Very Active

  • Members
  • PipPipPip
  • 190 posts
  • Location:Virginia
  • Version:LabVIEW 2010
  • Since:1999

Posted 01 July 2004 - 03:47 PM

What function(s) are you using for writing the data to file? If you're using one of the high-level VIs such as "Write Characters to File.vi", that VI opens, writes and closes the file every time you run it. If you're continually saving data in a loop, it's inefficient and unnecessary to keep opening and closing the same file that you're writing to in every iteration.

A better way to do it is to use the more advanced file functions. Use "Open/Create/Replace File.vi" to open/create a file refernce outside of your loop and then pass the file reference into the loop. Use the "Write File" function to write your data to the file reference inside the loop. Then after your loop, use the "Close Reference" function to close the file reference when your logging loop has finished running.

Note: The Write File function doesn't actually write the data to the file immediately, but merely buffers it until (I believe) either the buffer gets full or you close the reference, you have to use the "Flush File" function to actually write your data to the file, but it may add time to your iterations. I haven't tried it personally, but maybe you can use the "Flush File" VI in a parallel loop to actually write the data to the file reference at timed intervals?