Borrar filtros
Borrar filtros

How to get an ouput of a function in a try block ?

1 visualización (últimos 30 días)
Christophe
Christophe el 30 de Nov. de 2011
Hello !
I have the following function:
try
h = MyFunction(arg1,arg2);
catch
close(h);
end
Unfortunately it doesn't run because if an error occurs in MyFunction, ouput h isn't in the workspace of the main function. Yet, h is set in MyFunction before the error occurs.
How can I close a window opened by MyFunction, with the handle h, if an error occurs in MyFunction ?
Thank you for your help.

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 30 de Nov. de 2011
Add a try block to MyFunction!
Well that's the easiest way and it's pretty safe. You could also use assignin if you really just want h.

Más respuestas (2)

David Young
David Young el 30 de Nov. de 2011
Open the window first, and pass it as an argument to MyFunction.

Christophe
Christophe el 30 de Nov. de 2011
Thank you for your answer !

Categorías

Más información sobre Simulink Functions 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