define a counter which will starts counting from zero automatically when the count reaches to 10
7 次查看(过去 30 天)
显示 更早的评论
Hello all , can you please explain how to model a simple counter which will continue to count from the start when it reaches its max value to 10.
0 个评论
回答(2 个)
Chunru
2022-11-16
c = 0; % initialization
while true
c = mod( c + 1, 10); % count from 0 to 9 then re-start
end
Andy Bartlett
2022-11-16
In a Simulink model, click on the canvas and type "counter"
you'll see a list of blocks
one of these is called Counter Limited
it does exactly what you are asking for.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Schedule Model Components 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!