why do i get 'support for 'nargin' in a script has been removed?

12 ビュー (過去 30 日間)
Amisha Salian
Amisha Salian 2023 年 3 月 8 日
回答済み: Steven Lord 2023 年 3 月 8 日
narginchk(1,3)
Error using narginchk
You can only call nargin/nargout from within a MATLAB function.
nargoutchk(0,1)
%%
% Set default values for embedding parameters.
t = 1;
m = 1;
%%
% Set input arguments
if nargin > 2
t = varargin{3};
end
if nargin > 1
m = varargin{2};
end

回答 (2 件)

Cris LaPierre
Cris LaPierre 2023 年 3 月 8 日

Steven Lord
Steven Lord 2023 年 3 月 8 日
Script files aren't allowed to have input or output arguments. Therefore it doesn't make sense to ask how many inputs or outputs the script file has. In release R2016b the nargin, nargout, and inputname functions started throwing errors when called from within a script.

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by