dash.assert.nameValue

Throw error if inputs are not Name,Value pairs


Syntax



Description

[names, values] = dash.assert.nameValue(inputs)

Checks if the contents of a cell vector are Name,Value pairs. If not, throws an error. If so, returns the names as a string vector, and the values as a cell vector.

[names, values] = dash.assert.nameValue(inputs, nPrevious, extraInfo, header)

Customize error messages and IDs.


Input Arguments

inputs

cell vector
Typically varargin from a calling function

nPrevious

scalar positive integer
The number of inputs before varargin. Should exclude object reference in class methods.

extraInfo

string scalar
Extra information about the Name,Value input pairs.

Output Arguments

names

string vector [nPairs]
The ordered list of names in the Name,Value pairs

values

cell vector [nPairs]
The ordered list of values for the Name,Value pairs