How to skip command lines inside the loop
1 view (last 30 days)
Show older comments
I have a big while loop in some part of my project. Inside this loop, there are many operations going on and the results are checked for the convergency in the end. If the result is convergent, the loop ends but if it is non-convergent, I need to change the parameter and go back to the beginning of the loop again.
Here comes my question : I have 5 parameters to modify and all of the parameters should be checked in order. For example first parameter is STALLH Y and I would like to make it STALLH N if the result is non convergent and go to the beginning of the loop. When I evaluate the result again, I would like to modify the 2nd parameter IDLEPITCH 90 to IDLEPITCH 91. This will be like that until the end of the 5th parameter. But everytime I come to the parameter modification part, the code will check the previous parameters again which I dont want. Is there any suggestion for skipping some lines in command order according to the conditional cases?
Adam Filion on 29 Jun 2012
You can use either an if/else or switch/case structure to conditionally execute sections of code. The examples section in their documentation pages below is a good place to get started with them.
Find more on Loops and Conditional Statements 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!