stop execution of code to check results

2 visualizaciones (últimos 30 días)
Robert Demyanovich
Robert Demyanovich el 11 de Sept. de 2021
Editada: Star Strider el 11 de Sept. de 2021
Is there a way to stop code from executing so that results can be checked. For example something like
if i == 100000
Stop
end
I want to check the values of a parameter when the iteration is equal to 100,000.
How can I do that?

Respuesta aceptada

Star Strider
Star Strider el 11 de Sept. de 2021
Editada: Star Strider el 11 de Sept. de 2021
I would just display it instead —
if i == 100000
fprintf('Parameter = %f at iteration %d\n', Parameter, i)
end
Also consider the pause function.
Of course, it is also possible to save these to a vector.
.

Más respuestas (2)

the cyclist
the cyclist el 11 de Sept. de 2021
One way would be to use the debugger, specifically a conditional breakpoint.

Walter Roberson
Walter Roberson el 11 de Sept. de 2021
Use keyboard

Categorías

Más información sobre Debugging and Analysis 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