Force return from function during debugging

I am debugging a program in MATLAB R2016a and would like to return from a subfunction without ending the function. For example, you can write in code:

if(conditionMet)
  return;
end

If the condition is met, this will cause the function to end earlier and continue in the caller’s code. Although I am debugging, I would like to make the function end earlier, as if I were running into a command return. When I just type returnin debug mode, nothing happens. Is there a way to get a function to end earlier and continue to work?

+6
source share
2 answers

I think this is not possible at all with the current version of Matlab.

, () , .

function yourFunction ()
    breakDebug = false;
    ...
    if breakDebug
        return; % location at which you may break your function during debugging
    end
    ...
    return;
end

breakDebug , .

+2

MATLAB Central Matlab, feature(), :

if feature('IsDebugMode')
   return;
end
+4

Source: https://habr.com/ru/post/1015667/


All Articles