dash.parse.nameValue

Parse flagged options from Name,Value pairs


Syntax



Description

values = dash.parse.nameValue(inputs, flags, defaults)

Parses a set of flagged options given Name,Value input pairs. If a flag is not provided, returns a specified default argument for the flag. Throws an error if any inputs are not Flag,Value pairs, or if any flags are repeated.

values = dash.parse.nameValue(inputs, flags, defaults, nPrevious, header)

Customize error messages an IDs.


Input Arguments

inputs

cell vector
A collection of name-value pairs. Usually varargin from a calling function

flags

string vector [nFlags]
The list of recognized option flags

defaults

cell vector [nFlags]
The default value for each flag

nPrevious

scalar positive integer
The number of inputs before varargin in the calling function

Output Arguments

values

cell vector [nFlags]
The parsed value for each flag