12-08-2012 01:21 PM
Hi,
I want to save file or graph image by pressing buttons but it do not work. I attached the vi.
Solved! Go to Solution.
12-08-2012 01:27 PM - edited 12-08-2012 01:30 PM
You need to start with some LabVIEW tutorials, because your current code is completely wrong.
LabVIEW does not execute left to right. You have four independent code segments that all execute in parallel as soon as you press the run button. By the time the event occurs, the local variable has been read long ago as false and all code parts to the right have already completed.
Enlarge your event structure and place the respective code in the respective events. get rid of the local variables! Keep data in shift registers if needed.
Run your current VI in execution highlighting mode for some instructive insights on dataflow. 🙂
You code needs to be redesigned from scratch.
Look into state machine architectures.
12-08-2012 01:36 PM
@altenbach wrote:
You need to start with some LabVIEW tutorials, because your current code is completely wrong.
LabVIEW does not execute left to right. You have four independent code segments that all execute in parallel as soon as you press the run button. By the time the event occurs, the local variable has been read long ago as false and all code parts to the right have already completed.
Enlarge your event structure and place the respective code in the respective events. get rid of the local variables! Keep data in shift registers if needed.
Run your current VI in execution highlighting mode for some instructive insights on dataflow. 🙂
You code needs to be redesigned from scratch.
Look into state machine architectures.
I did as you said but it does not work properly 😞 Where did I do wrong thing?
12-08-2012 02:58 PM
@newbieeng wrote:
I did as you said but it does not work properly 😞 Where did I do wrong thing?
Then you need to tell us what "properly means". How do you run and operate it? What you expect to happen? Whan happens instead?
12-08-2012 03:44 PM
I put recording functions inside the event structure as you said. I just want to save data or graph image when I pressed the save buttons but when the program starts it immediately prompt me where to save. I really do not know how to fix that.
12-08-2012 04:03 PM
Because you have the timeout also assigned to the same event case and start with a zero timeout.
12-08-2012 04:30 PM
What could I do about the timeout? Do I need to cancel timeout event?
12-08-2012 04:36 PM
I remove timeout event and it works fine now. 🙂