FUNCTION REFERENCE

inputParser

Create a parser for function inputs (a handle object).

Create a parser for function inputs (a handle object).

Syntax

p = inputParser

Define arguments with addRequired, addOptional and addParameter, then call parse. Properties: FunctionName, CaseSensitive, KeepUnmatched, PartialMatching, StructExpand (settable), and Parameters, Results, Unmatched, UsingDefaults (read-only). copy(p) makes an independent parser.

Example

p = inputParser; p.addRequired('x'); p.parse(5); p.Results.x   % 5

Differences from MATLAB: Unmatched names must be valid MATLAB field names.

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