Is there a way to abort the code inside a function?
Mostrar comentarios más antiguos
Hey there,
Happy to know people are there when there is a challenge. I see that return function is used to abort the code when it appears in the root level of an m-code. But when used in a function, it returns the program flow back to the invoking function.
Having this in mind, I wanna terminate the whole program when a sign of accomplishment is met inside a function. One way seems to be using return for several times to reach the root level. but what's so frustrating here is that this method implies checking the condition in each return again and again till getting into the root.
I know that error function would resolve the issue, but it's not sensible to produce an error when the code is successfully accomplished.
Please advise as necessary.
Respuesta aceptada
Más respuestas (1)
Chad Greene
el 9 de Nov. de 2014
0 votos
Can you use a while loop with continue in your function?
1 comentario
Pouya Jamali
el 10 de Nov. de 2014
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!