LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data file close

Hi,

i am trying to measure the temperatue on every 30 sec and write it in a file. which i have done. But i am stuck with one problem can you please give me some clue.

 

After every 5 min the data file will close and creat a new file and will record new 10 data then it will close and creat a new file. file name will be automatic. like i have given file name kirit. second one will be kirit1, kirit2.......

 

i have attached my work here. thanks in advace.

0 Kudos
Message 1 of 11
(4,263 Views)

Hi data file...,

you should run your more often. If you press the stop button at the beginning, you habe to wait 30 sec, until the loop will stop. You can use 1 sec and count the iterations, in every 30 iteration you write the data to your file.

 

Hope it helps.

Mike

0 Kudos
Message 2 of 11
(4,242 Views)

Hello,

 

I hope you are doing fine. I am confused with your post. Is the problem is that the file closes after every 5 minutes or is it your aim that you want to close the file after every 5 minutes , reopen it automatically and then give it a new name ?

 

Any way by looking at your code , it seems that even if you press the stop button it has to wait 30 seconds which is not a good programming practice. I have modified your VI so that it takes temperature reading after every 30 seconds and when you press a stop button it stops after a second.

 

Best regards,

Fawad Nisar
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 3 of 11
(4,224 Views)

Hi

Thanks Nisar and Mike for your post.

 

Nisar,

i was not able to open your file beacuse i am using here 8.5 . can you please send me a image .  My aim is to record data in every 30 sec for 5 min . After 5 min it will close that file and will create a new file and record data for next 5min. it will continue like this if i press stop it will stop immidiately. Am i clear Please let me know .

 

with thanks

 

kirit.

0 Kudos
Message 4 of 11
(4,205 Views)

Hi,

 

Here is the 8.5 version. This will help you imediatly stop the code. We can look more into it on Monday.

 

Thanks,

Fawad Nisar
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 5 of 11
(4,196 Views)

Hi Nisar,

Thanks for your 8.5 version it work perfect now. can you give me some clue about the file close stuff.

 

My aim is to record data in every 30 sec for 5 min . After 5 min it will close that file and will create a new file and record data for next 5min. it will continue like this if i press stop it will stop immidiately.

 

thanks again

 

Kirit

0 Kudos
Message 6 of 11
(4,154 Views)

Hey data file,

 

I made a VI for you that blinks a light every 30 seconds and changes a filepath every 5 minutes. I did not put in the actual measurements or write to file, but I thought it would be enough to get you going. Basically the best way I can think to do this is to use shift registers to keep track of the iterations, then use case structures at your desired iterations (30 and 300 seconds). Hope this helps.

Chris Van Horn
Applications Engineer
0 Kudos
Message 7 of 11
(4,130 Views)

Hi,

thanks chris for your help. i was trying to do that with shift register . But an error said Missing Assignment to tunnel . iam not sure where i have done mistake. i have uploaded the file, please have a look.

 

thanks agian

 

Kirit

0 Kudos
Message 8 of 11
(4,115 Views)

Hello Kirit,

 

You need to wire a value to an output tunnel for every case in the case structure. In your VI, you did not have anything wired to the output tunnels for the 'False' case in the case structures. This is why you received the 'missing assignment to tunnel' error. 

 

Also, I noticed that your VI currently would not save the data to a new file every 5 minutes, as no new file path was being wired into the 'Write to text file' VI every 300 seconds Therefore, the inner case structure was not effective at all. I have attached a modified version of your VI to this post that should give you an idea as to how it can be done. 

 

I hope this helps! 

Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 9 of 11
(4,105 Views)

Hi vivek,

thanks it worked but it was not upto my desire as i wanted to close the output in every 5 min and create a new one. i have attached the output of that file first one. it create in the same file.

 

then i modified the VI and can have my desire file close and open a new one but i think i have not done something smart programming. Even it has a problem first file store more data. but the rest file store one data  and close.

 

Do you think i need to avoid shift register to avoid that complicacy.

 

with thanks

 

Kirit

Download All
0 Kudos
Message 10 of 11
(4,074 Views)