Documentation

getNumInputsImpl

Class: matlab.System
Package: matlab

Number of inputs to step method

Syntax

num = getNumInputsImpl(obj)

Description

num = getNumInputsImpl(obj) returns the number of inputs num expected by the step method. The System object™ input argument is not included in the count. For example, if your step method syntax is step(h_obj,x1,x2,x3), getNumInputs returns 3.

If your step method has a variable number of inputs (uses varargin), implement the getNumInputsImpl method in your class definition file.

If the number of inputs expected by the step method is fixed (does not use varargin), the default getNumInputsImpl determines the required number of inputs directly from the step method. In this case, you do not need to include getNumInputsImpl in your class definition file.

getNumInputsImpl is called by the getNumInputs method and by the setup method if the number of inputs has not been determined already.

    Note:   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

obj

System object

Output Arguments

num

Number of inputs expected by the step method for the specified object, returned as an integer.

Default: 1

Examples

collapse all

Set Number of Inputs

Specify the number of inputs (2, in this case) expected by the step method.

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

Set Number of Inputs to Zero

Specify that the step method does not accept any inputs.

methods (Access = protected)
   function num = getNumInputsImpl(~)
      num = 0;
   end
end
Was this topic helpful?