addParamValue
Older name of addParameter for adding a name-value argument.
Category: Programming > Functions
Syntax
addParamValue(p, name, default)
Declares a name-value argument with a default.
addParamValue(p, name, default, validationFcn)
Also validates the value.
Description
addParamValue was the original way to declare a name-value argument and still works. New code should use addParameter, which behaves the same in this respect and is the form the documentation uses today.
Input arguments
p- An
inputParserobject. name- Parameter name, as text.
default- Value used when the parameter is not given.
validationFcn- Validation function handle.
Example
Same effect as addParameter
p = inputParser;
addParamValue(p, 'Scale', 1);
parse(p, 'Scale', 3);
p.Results.Scale
Output
ans = 3