08-03-2010 05:42 AM
I am trying to write a VI to store data in text file. To avoid a too large file, I want to store the data in different files. I want these files to be created at the beginning of every hour. How could I achieve this?
Thanks in advance!
Solved! Go to Solution.
08-03-2010 06:32 AM
Hey,
Maybe you could integrate this in your code. It will increment the number in the filename every half second.
Rgds - Rkll
08-03-2010 06:32 AM
Hey,
Maybe you could integrate this in your code. It will increment the number in the filename every half second.
Rgds - Rkll
08-03-2010 11:26 AM - edited 08-03-2010 11:28 AM
Many people like to have a timestamp in their file name. Makes it unique and gives information on the time the file was created. Here is some code that will create a new filename with timestamp every hour on the hour. It checks every second to see if the minutes part of the time string is "00". If so, then it creates a filename. The date string keeps it unique from day to day.
Ooops. Just noticed a flaw. The code will create a new filename every second as long as the minutes are 00. Changing the delay value to one minute (60000) should fix the problem.
08-04-2010 02:59 AM
Thank you for your help. It's very helpful!
08-04-2010 03:04 AM
Thank you very much for your reply. I tried to use time stamp to control the creation of the files. However, it seems that the wait function isn't stable enough, it didn't sample as expected. For example, I set the wait function to wait for 10ms, but it delays for about 12ms. It's really weird! Do you know how to fix it?
Thanks a lot!
08-04-2010 03:10 AM
Can I have one more question?
I tried to use the way you told me to control the creation of the files. However, it seems that the wait function isn't stable enough, it didn't sample as expected. For example, I set the wait function to wait for 10ms and jump out of the ture or false loop to check whether the minute is 00, but it delays for about 12ms. So if I use a for loop with 360,000 iterations, and set a wait for 10ms in each loop, it always misses the minute of 00. It's really weird!
Do you know how to fix it?
Thank you very much!
08-04-2010 03:13 AM
08-04-2010 03:43 AM
I like the video very much. It's really a nice one and very helpful.
Thank you very much!
08-04-2010 03:52 AM
Glad to help:) That guy have many nice videos that also might be useful some day.