MATLAB 帮助中心
System object 的输入参量的数目
numInputs = nargin(obj)
nargin
numInputs = nargin(obj) 返回 obj 算法定义所需要的输入参量的数目。此函数是常规 nargin 函数在 System object™ 中的扩展应用。
numInputs
obj
示例
nargin 返回在对当前正在执行的 System object 进行的调用中指定的输入参量的数目。此语法只能在 System object 环境中使用。
全部折叠
此示例说明对具有可变大小输入的 System object AddUp 使用 nargin 时返回的输出。
AddUp
marker System object 定义如下:
marker
classdef AddUp < matlab.System methods(Access = protected) function y = stepImpl(obj,u,varargin) % Implement algorithm. y = u + sum([varargin{:}]); end end end
创建对象并调用 nargin。
total = AddUp(); nargin(total)
ans = -2
要查询的 System object。
此参量表示调用 System object 所需的输入数目。
如果输出非负,则当对象处于正在使用中状态时,不能更改输入数目。
如果输出为负,则不同调用中的输入数目可以更改。当 System object 没有覆盖 getNumInputsImpl 并且 stepImpl 签名中包含 varargin 时,就会出现这种情况。
getNumInputsImpl
stepImpl
varargin
在 R2018a 中推出
nargin | nargout | getNumInputsImpl | getNumInputs
nargout
getNumInputs
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 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处