How can I process an external System Signal in a Matlab executable

2 views (last 30 days)
I'm creating a Matlab executable via mcc to run a tool on a cluster (in a linux environment). I have a situation, where it is necessary to be able to checkpoint my computation and graceously exit when a given external signal is received. I saw that there is the onCleanup function, which works nicely within Matlab. However when the code is compiled as an executable onCleanup does not react to any external signals. Regardless on whether I send a signal to the process via kill or just press ctrl+c in the terminal running the code it just terminates without executing the cleanup. Unfortunately I haven't found any other method to handle external events (maybe I just looked in the wrong places).
Could anyone tell me whether there is a way to handle external signals in a matlab executable?

Answers (0)


Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!