Know if my script gets an error
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Javier Naranjo
el 3 de Oct. de 2017
Comentada: Jan
el 3 de Oct. de 2017
Hello everybody,
I am running a Matlab script in my Linux console and when it gets an error, the code continues its execution. Is there a way to stop the execution if an error occurs and not generate the outputs.
Thanks in advance,
Javi
2 comentarios
Geoff Hayes
el 3 de Oct. de 2017
Javier - what type of error are you seeing? Typically the script will end if an error is encountered. Please provide more details.
Respuesta aceptada
Jan
el 3 de Oct. de 2017
What does "running a Matlab script in a Linux console" exactly mean? You can run Matlab scripts inside Matlab only. Then the command error stops the execution, except if you prevent the script from doing so by a try/catch block. If this happens, the solution is easy: Do not let the code proceed after a severe problem, but stop if by an error.
Without seeing the relevant part of the code or understanding where you run what, I cannot post a more specific answer.
2 comentarios
Jan
el 3 de Oct. de 2017
If an error occurs, the function of script stops. This is the nature of errors. I cannot reconsider, what you mean by "it never stops". At least without seeing any detail, it will be impossible to solve the problem.
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!