FUNCTION REFERENCE
arguments
Declare function input and output argument validation.
Declare function input and output argument validation.
Syntax
arguments; name (dims) class {validators} = default; endSyntax
arguments; opts.Name (dims) class {validators} = default; endSyntax
arguments (Repeating); name (dims) class {validators}; endSpecifies size, class, validator functions, and default values for positional, name-value (`opts.Name`), repeating (`Repeating`), and output (`Output`) function arguments at the start of a function body. Name-value arguments accept `'Name', value` pairs, `Name=value` syntax, or a scalar struct, with case-insensitive unique partial name matching. Repeating arguments are validated per group and delivered as cell arrays.
Example
af([1 2], 'Scale', 3); function y = af(x, opts); arguments; x (1,:) double {mustBeNonnegative}; opts.Scale (1,1) double = 1; end; y = x * opts.Scale; end % [3 6]Differences from MATLAB: Package-qualified custom validator functions on the path follow standard function resolution.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.