How To make matlab rerun the program?

71 views (last 30 days)
ksjdn sdfs
ksjdn sdfs on 4 Feb 2019
Answered: Venkat Krisshna on 8 Apr 2021
i want to make matlab rerun a code for me automatically, after the conditions are not met!
  1 Comment
Adam Danz
Adam Danz on 4 Feb 2019
What's preventing you from writing a conditional that calls the function again?
Are you saying that the conditional is within the function you'd like to re-run? That could lead to recursion or an infinite loop which is a sign of poor coding. Maybe with some more info you could get better advice.

Sign in to comment.

Answers (2)

Kevin Phung
Kevin Phung on 4 Feb 2019
Use a while loop to keep re-running your function or script while some condition is true (in this case, 'not met'):

Venkat Krisshna
Venkat Krisshna on 8 Apr 2021
Use a while loop or an infinite while loop where you manually terminate the program.
tt=10;
iter=0;
while(tt>0)
iter=iter+1
pause(1)
<your program>
end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!