parse — Parse name-value arguments with an inputParser.
inputParser supports case-sensitive named parameters with defaults. addParameter registers a parameter and rejects duplicates. parse accepts complete name-value pairs, rejects unknown names, uses the last supplied value for duplicates, and publishes Results only after validation. The current implementation does not support validators, positional parameters, or parser configuration options.
Syntax
p = parse(p, Name, Value, ...)Inputs
p- Type
Any- Required
- Yes
- Default
- —
- Description
- inputParser handle object.
nameValue- Type
Any- Required
- Variadic
- Default
- —
- Description
- Name-value arguments to parse.
Returns
p- Type
Any- Description
- Updated inputParser handle object.
Errors
RunMat:inputParser:InvalidParser- When
- The parser argument is not a valid inputParser handle.
- Message
inputParser: expected a valid inputParser handle
RunMat:inputParser:InvalidParameterName- When
- A parameter name is not a character vector or string scalar.
- Message
inputParser: parameter names must be text scalars
RunMat:inputParser:NameValuePairs- When
- The parse argument list does not contain complete name-value pairs.
- Message
inputParser: expected name-value pairs
RunMat:inputParser:UnknownParameter- When
- A parsed name does not match any registered parameter.
- Message
inputParser: unknown parameter name
Example
Parse a named parameter
p = inputParser(); addParameter(p, 'Count', 2); parse(p, 'Count', 5); result = p.Results.Count;Using parse with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how parse changes the result.
Run a small parse example, explain the result, then change one input and compare the output.
Related Introspection functions
addlistener · addParameter · addprop · assignin · builtin · cancel · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · eval · evalc · evalin · feval · findprop · func2str · functions · get.p · getcallinfo · getmethod · inputname · inputParser · isa · ischar · isdeployed · iskeyword · ismethod · isobject · isstring · isUnderlyingType · isvalid · keyboard · loadobj · localfunctions · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mfilename · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · new_object · notify · numArgumentsFromSubscript · onCleanup · saveobj · set.p · stats · str2func · subsasgn · subsref · superclasses · underlyingType · verLessThan · version · which · who · whos
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.