Main Content

getNumInputsImpl

Class: matlab.System

Number of inputs to the System object

Syntax

num = getNumInputsImpl(obj)

Description

num = getNumInputsImpl(obj) returns the number of inputs expected by the System object™.

If the signature of stepImpl or updateImpl does not include varargin, the System object can determine the number of inputs from the method signature. In this case, you do not need to include getNumInputsImpl in your class definition file.

If the signature of stepImpl or updateImpl does include varargin, you can implement the getNumInputsImpl method in your class definition file to determine the number of inputs. You can use nargin in the stepImpl method to get the number of inputs the object was called with.

Method Authoring Tips

  • You must set Access = protected for this method.

  • You cannot modify any properties in this method.

  • If you set the return argument, num, from an object property, that object property must have the Nontunable attribute.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your getNumInputsImpl method does not use the object, you can replace this input with ~.

Output Arguments

expand all

Number of inputs expected when running the object, returned as an integer.

Examples

expand all

Specify the number of inputs (two, in this case) expected by the object.

methods (Access = protected)
   function num = getNumInputsImpl(~)
      num = 2;
   end
end

Specify that the object does not accept any inputs.

methods (Access = protected)
   function num = getNumInputsImpl(~)
      num = 0;
   end
end

Version History

Introduced in R2011b