matlab.System.getNumInputsImpl - Number of inputs to the System object - MATLAB (original) (raw)

Main Content

Class: matlab.System

Number of inputs to the System object

Syntax

num = getNumInputsImpl(obj)

Description

[num](#bs4on9p-1-num) = getNumInputsImpl([obj](#bs4on9p-1%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8)) 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 includegetNumInputsImpl 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

Input Arguments

expand all

obj — System object

System object

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

num — Number of inputs

1 (default) | integer

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

Examples

expand all

Set Number of Inputs

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

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

Set Number of Inputs to Zero

Specify that the object does not accept any inputs.

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

Version History

Introduced in R2011b