I am trying to create a function that aborts whatever mfile is currently executing after issuing a warning. I see no way of avoiding EVALIN for this and so implemented the following,
function abort_and_warn warning 'Aborting' evalin('caller', 'return');end
However, a simple test of this code in R2020a,
function test disp 'do this' abort_and_warn disp 'do that'end
fails to block the execution of the final line:
>> testdo thisWarning: Aborting > In test>abort_and_warn (line 12) In test (line 5) do that
Is this an undocumented limitation of EVALIN? I see nothing here to imply that EVALIN should be unable to issue the return command in the caller wokspace.
Best Answer