nargin - Number of input arguments for System object - MATLAB (original) (raw)
Main Content
Number of input arguments for System object
Syntax
Description
[numInputs](#d126e2109211) = nargin([obj](#d126e2109182))
returns the number of input arguments that are required by the obj
algorithm definition. This function is a System objectâ„¢ extension of the general nargin function.
nargin
returns the number of input arguments specified in the call to the currently executing System object. Use this syntax in the body of a System object only.
Examples
This example shows the output from nargin
when used on a System object AddUp
with a variable-size input.
A marker
System object is defined as follows:
classdef AddUp < matlab.System
methods(Access = protected)
function y = stepImpl(obj,u,varargin)
% Implement algorithm.
y = u + sum([varargin{:}]);
end
end
end
Create the object and call nargin
.
total = AddUp(); nargin(total)
Input Arguments
Output Arguments
This argument represents the number of inputs needed to call the System object.
If the output is nonnegative, the number of inputs cannot change while the object is in use.
If the output is negative, the number of inputs can change from call to call. This situation occurs when the System object does not override getNumInputsImpl
and the stepImpl
signature contains varargin
.
Version History
Introduced in R2018a