Ano Ano Posted April 13, 2011 Report Share Posted April 13, 2011 Hello, I have a 10 input threshold detector in a while loop and I the data are collected outside the loop and saved when the "stop" button is pushed If this program mis interrupted by something else besides the "stop" button (ie power cut) then I will not save any data. How can I save the data while the program is running and also have some output IF the process is interrupted? I tried saving the data in the loop but it creates many files. I have placed a time tag on the file path so that each time the program starts it writes the data/time on the file name. Inside the loop when it saves the data, it tries to save it to the same file but the time and hence file name have changed, so it creates multiple files. How can I solve this? Thank you in advance, Quote Link to comment
dannyt Posted April 13, 2011 Report Share Posted April 13, 2011 I tried saving the data in the loop but it creates many files. I have placed a time tag on the file path so that each time the program starts it writes the data/time on the file name. Inside the loop when it saves the data, it tries to save it to the same file but the time and hence file name have changed, so it creates multiple files. How can I solve this? It is quite simple to save the data in each loop to only one file, by doing something like this - Firstly as you are talking about spreadsheets I would format any data to be saved in a CSV format so this can easily be open in Excel or as a text file later. Open a file before you loop starts, this could be either a new files or an existing one. Pass the reference to this file into you loop and each time round your loop append you data into the file, when your loop finishes close the file. Look in the LabVIEW Example Finder, there is a example VI "Write to Text File.vi" in the Fundamentals --> File Input & Output category that shows how to write to the same file in a loop Danny Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.