Determine if MATLAB started with
MATLAB® starts with
-batch option. Otherwise, the function returns
false. Use the
-batch option to start MATLAB non-interactively.
Use this function to guard code from being executed when MATLAB is running non-interactively with the
-batch startup option
and user input is either not desired or not supported in this mode.
Suppose that you have a test that requires user input. You can
automate this test to run using the
matlab -batch startup
Prompt the user for input during interactive testing or specify a default value for automated testing.
if ~batchStartupOptionUsed answer = inputdlg("Enter a number"); else answer = 10; end