How to execute a function when stop execution of a script is hit in MATLAB?

  Kiến thức lập trình

I am connecting the MATLAB client with an external message broker. I am currently testing the error handling scenarios and I observed that if my script is running and I hit the stop button, the connection is not getting stopped.

I would like to run a function as soon as STOP button is hit in a running script or even clearing some variables in the workspace would also work. How can this be possible ?

Thanks,
Dhruv

LEAVE A COMMENT