- Add a "While Iterator" block from the Simulink Library Browser. This block will create a loop that repeats your code until a certain condition is met.
- Connect the output of your code (the signal that controls the motor rotation) to the input of the "While Iterator" block.
- Add a "Relational Operator" block from the Simulink Library Browser. Set the input of the "Relational Operator" block to the desired condition for stopping the loop.
- Add a "Constant" block from the Simulink Library Browser and set its value to "true". Connect this block to the "Start" input of the "While Iterator" block. This will ensure that the loop starts when the simulation begins.
repeating a simulink program
8 views (last 30 days)
Show older comments
Hello,
Please i have the following code,
0 Comments
Answers (2)
Pratyush
on 25 Oct 2023
Hi Youness,
I understand that you want to repeat your code execution for 2hrs. The While Iterator block could be used for this purpose. You can refer to this documentation for more details on While Iterator block: https://in.mathworks.com/help/simulink/slref/whileiterator.html
To achieve this:
Hope this helps.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!