错误使用 nargin 您只能从 matlab 函数中调用 nargin/nargout。
时间: 2023-05-01 20:02:36 浏览: 264
b'\xe9\x94\x99\xe8\xaf\xaf\xe4\xbd\xbf\xe7\x94\xa8 nargin \xe6\x82\xa8\xe5\x8f\xaa\xe8\x83\xbd\xe4\xbb\x8e matlab \xe5\x87\xbd\xe6\x95\xb0\xe4\xb8\xad\xe8\xb0\x83\xe7\x94\xa8 nargin/nargout\xe3\x80\x82'
在MATLAB函数中,可以使用nargin/nargout来确定参数的数量和函数输出的数量。如果使用不当,可能会出现错误。
相关问题
matlab中nargin函数的用法
nargin 是一个内置函数,用于求函数的输入参数个数。在函数中使用 nargin 可以获取调用函数时传入的参数个数。例如:
```
function output = myFunction(a, b, c)
n = nargin;
output = n;
end
```
调用 myFunction(1,2,3) 时, nargin 的值为 3。
另外,nargin 可以和 nargout 配合使用, nargout 求的是函数的输出参数个数。
matlab的nargin函数
nargin 是一个内置函数,用于求函数的输入参数个数。在函数中使用 nargin 可以获取调用函数时传入的参数个数。例如:
```
function output = myFunction(a, b, c)
n = nargin;
output = n;
end
```
调用 myFunction(1,2,3) 时, nargin 的值为 3。
另外,nargin 可以和 nargout 配合使用, nargout 求的是函数的输出参数个数。
相关推荐
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)