FUNCTION REFERENCE
onCleanup
Run a callback when its cleanup object leaves all workspaces.
Run a callback when its cleanup object leaves all workspaces.
Syntax
object = onCleanup(task)Example
c=onCleanup(@() disp('done')); clear c; % doneDifferences from MATLAB: Uses tagged structure storage; callbacks run at interpreter statement and function boundaries.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.