From: Pat Finder on
In many languages, it is possible to know while executing the code, if the code is currently being debugged or not.

Is there a built-in Matlab mechanism for the program to know when it is running in the debugger?

Otherwise I would set a global variable, but hey, why bother if it isn't necessary...

Thanks.
From: ImageAnalyst on
Aren't you always debugging, unless you've compiled it into an
executable? In the case of an executable, you can check the
"isdeployed" variable, which will be true for an executable and false
for an m-file.