How to skip command lines inside the loop
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
Adam Filion
2012-6-29
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!