Reset Clock Block - Matlab/Simulink
Show older comments
Hello,
i have the simulation time as an input singal coming from a Clock Block. On condition (for example: when another signal x is greater or equal to a constant a) i want the time signal, that comes from the Clock Block, to be set to 0 and restart counting up again while the simulation time keeps going.
I do not know how to do this and whether it is purposeful to use the Clock Block. I hope someone can help and thank in advance!
Cheers
Answers (1)
Gayan
on 27 Oct 2017
2 votes
Im not sure it is possible directly.
But there is a workaround. Instead of using the output of the clock directly modify it.
Method 1; Use If block in held option and substract the value. I use a pulse generator as the reset trigger. See the image below.


>>
Method 2, you can use a memory block to subtract a constant from the clock out.
Then new_clock = Clock - value stored in mem block. When ever you want to reset the clock just set the mem block value to Clock.
Categories
Find more on Sources 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!