LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data starting with 0 second

Solved!
Go to solution

Neither %S%d nor %S nor %d provided the result that I want. It didn't start from zero in the save file. With %S%d, the time in the file was starting from 0301, 0302 ... which is wrong.

 

I put the delay function in the sub vi because I want the user to be able to adjust how fast the data is saved.

 

 

0 Kudos
Message 21 of 36
(775 Views)

If you want the time to start at 0 you will have to place your initial timestamp in the loop itself and get it at the same time you get the iteration timestamp. This will only be done the first time you execute the loop. Place this timestamp into a shift register and use that value for all other iterations of the loop.

 

As for the time being in teh subVI it is still a very poor design. This is effectively a task of the UI of your program and should be done at that level. The subVI should simply be called and do its work. No delays or anything else. What would happen if someone tried to use this subVI in another program. They may not want the delay or have some other method of controlling when this subVI is called. By place the wait in the subVI you have made this subVI much less reusable.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 22 of 36
(769 Views)
Your subVI should not have any time function at all. That includes a wait and any format to time string. This is much simpler than you are making it.
0 Kudos
Message 23 of 36
(764 Views)
@Mark yedinak

As you can see in my attached vi, you mean I should add a shift register instead of the tunnel?

My sub vi might be a poor design containing time delay but the purpose is to make the user enable to adjust how fast the data can be saved. This probably is the only way to do it.
0 Kudos
Message 24 of 36
(755 Views)

@ Mark Yedinak,

 

I would appreciate if you can adjust directly in my code. I already tried what you have said but it didn't work.

0 Kudos
Message 25 of 36
(750 Views)
Solution
Accepted by Bombbooo

Here is the VI.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 26 of 36
(737 Views)

Could you please save it in 2010 version? thanks

0 Kudos
Message 27 of 36
(728 Views)

Here it is.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 28 of 36
(717 Views)

Thank you for adjusting my code. It does starts from zero. However, when it reaches 60, it comes back to zero again which is supposed to be 61 instead. How can I program that?

0 Kudos
Message 29 of 36
(713 Views)

You could modify the format specifier for the Format String to include the minute value. Or you could simply format the difference you calculated using a regular format string (or format number into string).



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 30 of 36
(710 Views)