batchStartupOptionUsed - Determine if MATLAB started with -batch option - MATLAB (original) (raw)
Main Content
Determine if MATLAB started with -batch
option
Syntax
Description
batchStartupOptionUsed
returns true
when MATLABĀ® starts with -batch
option. Otherwise, the function returnsfalse
. 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.
Examples
Suppose that you have a test that requires user input. You can automate this test to run using the matlab -batch
startup option.
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
Version History
Introduced in R2019a