LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving text file at different rate

Solved!
Go to solution

Hello all,

 

I am a little bit new to LabView, so maybe this question is trivial, but is giving me a lot of pain.

 

I want to continuously save a given string at two different rates; in the example provided these rates are at every 500 ms and 50 ms, in two different text files (one for each rate). I tried to use while structured loops for this purpose. When I use only one, it works fine, but when I use both of them at the same time, it seems Labview limits both paths to the lowest speed, which in this case is obviously 500 ms, and eventually I obtain two exact files with the string saved at 500 ms period.

 

How can I make it work?

 

Thanks in advance.

0 Kudos
Message 1 of 4
(3,134 Views)
Solution
Accepted by topic author JohnS1999

Your loops both stop after one iteration. Maybe you should keep them running until you want to stop the program. Add a proper stop condition to each.

 

(It almost seems that you are using "continuous run" mode where the program starts over once all code has finished. Don't! That's only a debugging tool. Use the plain run button instead.)

Message 2 of 4
(3,082 Views)

God! I knew it was simple! I did that change and everything worked magically. Thanks a lot!

0 Kudos
Message 3 of 4
(3,064 Views)

You still have ways to go for a more reasonable code.

 

For example, typically you want to open the files before the loop, keep appending inside the loops, and close the files after the loop, when the program stops. Now you don't even need to set the file position inside the loops because it will automatically keep writing right after the previous write position. This is much more efficient than to open and close the file with each iteration.

 

 

0 Kudos
Message 4 of 4
(2,993 Views)