Recently I learned that we can use onCleanup to release sources
My code also uses timer
However the two things do not work together.
function runMe
f = fopen('log','w');
fprintf(f, 'exit');
fclose(f);
end
c = onCleanup(@() runMe());
t = timer;
t.TimerFcn = @(~,~) exit();
t.StartDelay = 10;
start(t);
When time is out, the 'log' file is not generated. If I use the 'exit' command, runMe is called. finish.m works at this case.
Is this expected? Or maybe I did not use them correctly.