Skip to content

parseparams

miscellaneous · scripts/miscellaneous/parseparams.m

: [reg, prop] = parseparams (params)
: [reg, v1, v2, …] = parseparams (params, name1, def1, name2, def2, …)

Split the cell array params (typically varargin) into the leading positional arguments reg and the trailing options.

The options start at the first element that is a character row. With a single output pair they are returned unchanged in prop. When option names and defaults are given, the options are read as name/value pairs and the value for each name (or its default) is returned in v1, v2, …; names compare case-insensitively and the last occurrence wins.