How to get out of the for cycle and start all over again?

1 visualización (últimos 30 días)
Good morning,
first of all I apologize for my poor English, however:
I have to run a matlab program already done, this program is given some inputs (a = 1, B = 2 ...), then I with an if cycle check if the results are good. If the results are not good I want you to update the inputs (for example put a = a + 1 etc.) and then go back to the lines of the previous program to redo the calculations again. What I can't do is go back to a previous line in the program. Can someone help me?
To get a better understanding of what the problem is, I will give an example:
P_matlab.png

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Oct. de 2019
a = 1;
while true
B = a*23+54 ;
if B < 89
a = a+1;
continue;
end
end
Or more cleanly,
a = 1;
B = a*23+54 ;
while B < 89
a = a + 1;
B = a*23+54 ;
end
  2 comentarios
Simone Fratton
Simone Fratton el 19 de Oct. de 2019
I'm looking for a way to start again from line 2, ok that in the example the problem could be so, but a command start from ... just doesn't exist?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by