matlab.metadata.Argument Class
Namespace: matlab.metadata
Description
The matlab.metadata.Argument class provides information about a specific
input or output argument of a function or method.
Creation
You cannot instantiate a matlab.metadata.Argument object directly. The
Inputs and Outputs properties of
matlab.metadata.CallSignature are of type Argument.
Properties
Argument name and group name, specified as a
matlab.metadata.ArgumentIdentifier instance. The instance specifies the
argument name in its Name property. For a name-value argument, the
GroupName property specifies the group name of the
argument.
For functions that are part of the MATLAB® executable, the Name property value is
varargin for input arguments and varargout for
output arguments.
Attributes:
GetAccess | public |
SetAccess | private |
This property is currently not used.
Attributes:
GetAccess | public |
SetAccess | private |
This property is currently not used.
Attributes:
GetAccess | public |
SetAccess | private |
Indicates if the argument is required, specified as a logical 0
or 1. If the value is 1, the argument is
required.
Attributes:
GetAccess | public |
SetAccess | private |
Indicates if the argument is repeating, specified as a logical 0
or 1. If the value is 1, the argument is
repeating.
Attributes:
GetAccess | public |
SetAccess | private |
Indicates if the argument is a name-value argument, specified as a logical
0 or 1. If the value is 1,
the argument is a name-value argument.
Attributes:
GetAccess | public |
SetAccess | private |
Describes the validation the argument uses, if any, specified as a matlab.metadata.ArgumentValidation instance. The instance describes any size,
class or validation functions used in the argument definition. If the argument does not
use validation, the property value is an empty array.
Attributes:
GetAccess | public |
SetAccess | private |
Describes the default value of the argument, if any, specified as a matlab.metadata.DefaultArgumentValue instance. The instance describes the
value itself and whether the value depends on any other arguments. If the argument is
required, this property value is an empty array.
Attributes:
GetAccess | public |
SetAccess | private |
The class that defines options for a name-value argument, specified as a matlab.metadata.Class instance. When a name-value argument is defined using
the ? syntax, this property
identifies ClassName. If the name-value
argument is not defined using this syntax, the property is an empty array. See Name-Value Arguments from Class Properties for more
information.ClassName
Attributes:
GetAccess | public |
SetAccess | private |
Examples
Save the function plotEllipse on your
path.
function plotEllipse(a,b,center,lineOpts) % plotEllipse Plot an ellipse % Plots an ellipse using the inputs a and b as the semi-major % and semi-minor axes. center is an optional input that specifies % the coordinates of the center of the ellipse. Specify Color and % LineStyle as optional name-value arguments. arguments a {mustBeNumeric,mustBePositive} b {mustBeNumeric,mustBePositive} center (1,2) {mustBeNumeric} = [0 0] lineOpts.Color {mustBeTextScalar} = "black" lineOpts.LineStyle {mustBeTextScalar} = "-" end angle = linspace(0,2*pi); xval = a*cos(angle) + center(1); yval = b*sin(angle) + center(2); plot(xval,yval,Color=lineOpts.Color,LineStyle=lineOpts.LineStyle) axis equal end
To get information about the function using introspection, call
metafunction to create a matlab.metadata.Function
instance. Access the Signature property. The property shows that
the function has five input arguments and uses an input arguments block.
mf = metafunction("plotEllipse");
ms = mf.Signaturems =
CallSignature with properties:
Inputs: [1×5 matlab.metadata.Argument]
Outputs: [1×0 matlab.metadata.Argument]
HasInputValidation: 1
HasOutputValidation: 0Access the matlab.metadata.Argument instance that describes the first
input . The metadata shows that the identifier is a, and it is a
required argument. The function also uses argument validation for a, which is described
by the matlab.metadata.ArgumentValidation instance stored in the
Validation property of Argument.
ms.Inputs(1)
ans =
Argument with properties:
Identifier: a
Description: ''
DetailedDescription: ''
Required: 1
Repeating: 0
NameValue: 0
Validation: [1×1 matlab.metadata.ArgumentValidation]
DefaultValue: [0×0 matlab.metadata.DefaultArgumentValue]
SourceClass: [0×0 matlab.metadata.Class]Access the fourth input argument. The metadata shows that the identifier is
lineOpts.Color, and it is a name-value argument that does not
have a source class.
ms.Inputs(4)
ans =
Argument with properties:
Identifier: lineOpts.Color
Description: ''
DetailedDescription: ''
Required: 0
Repeating: 0
NameValue: 1
Validation: [1×1 matlab.metadata.ArgumentValidation]
DefaultValue: [1×1 matlab.metadata.DefaultArgumentValue]
SourceClass: [0×0 matlab.metadata.Class]Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)