FUNCTION REFERENCE

addOptional

Add an optional positional argument to an inputParser.

Add an optional positional argument to an inputParser.

Syntax

addOptional(p, name, default)

Syntax

addOptional(p, name, default, validator)

When parameters are also defined, a char argument goes to the optional argument only if its validator accepts it; otherwise it starts the name-value pairs.

Example

p = inputParser; addOptional(p, 'n', 3); parse(p); p.Results.n   % 3

Differences from MATLAB: none known.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.