Real-Time Synchronization dose not pause, please help
1 view (last 30 days)
Show older comments
Hi everyone!
I have a problem using the 'Real-Time Synchronization' block. My model is paused at certain times but the 'Real-Time Synchronization' does not seem to be paused too. I noticed this because when I resume the model, the model seem to run a lot faster to catch with the missed ticks(the lag during pause period).
What I really want is for the model to resume at exactly where it was when it was paused and continue to run at the original rate without attempting to catch up with the missed time during the pause period. How can I achieve this?
I just hope that I have made myself clear enough.
Thanks alot Bethel
0 Comments
Accepted Answer
Jan Houska
on 2 Aug 2012
Edited: Jan Houska
on 2 Aug 2012
What you are trying to do is somewhat against the purpose of real-time synchronization. If you have your model connected to a real-world device, you can stop your model with the Pause button but this will (of course) not stop the real-world device time. Strange things may then happen when you continue the simulation because the state of the real-world device will probably not match what your model expects.
That said, it is possible to pause the real-time clock when the model pauses if you know what you are doing. In your model, go to File, Model Properties, Callbacks. As the PauseFcn callback, use
stop(getfield(RT.Kernel, 'Timers'));
and as the ContinueFcn callback, use
start(getfield(RT.Kernel, 'Timers'));
Please be warned that these functions are not documented and may be changed in a future release.
3 Comments
More Answers (0)
See Also
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!