Home >Common Problem >What does nargin mean in matlab?

What does nargin mean in matlab?

(*-*)浩
(*-*)浩Original
2019-07-25 13:16:5529633browse

nargin is the abbreviation of "number of input arguments". When defining a function in MATLAB, inside the function body, nargin is a function used to determine the number of input variables.

What does nargin mean in matlab?

Enter help nargin or doc nargin in the matlab command window to get help information for this function. (Recommended learning: PHP video tutorial)

Function

nargin is a function used to determine the number of input variables, especially when using In functions with variable parameter lists, it is convenient to use nargin to obtain the number of input parameters.

Calling format

nargin
nargin(fx)

Function description

nargin returns the input parameters by calling the currently executing function Quantity, only use the nargin syntax feature within the function body.

nargin(fx) returns the number of input parameters in the definition statement of function fx. If the function includes varargin in its definition, then the number of inputs returned by nargin is negative.

For example, the function foo input has three parameters a, b, and varargin, then the return value of nargin('foo") is -3.

For more PHP related technical articles, please visit PHP Graphic Tutorial column to learn!

The above is the detailed content of What does nargin mean in matlab?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn