on error

2 visualizaciones (últimos 30 días)
Christof
Christof el 5 de Jul. de 2011
Hello, I connect to an external db. If the ping fails, I would like matlab to execute a certain code. so something in the form
ping(C)
if "invalid connection" then .... end
...
How can I do this in Matlab? Thanks

Respuesta aceptada

Bob Hamans
Bob Hamans el 5 de Jul. de 2011
You could attempt to open the connection and if that fails execute a different piece of code. See the documentation:
try
MATLAB commands % Try block
catch ME
MATLAB commands % Catch block
end

Más respuestas (1)

Christof
Christof el 5 de Jul. de 2011
Thanks, that s exactly what i was looking for

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by