What is the meaning of this code snippet?
2 ビュー (過去 30 日間)
古いコメントを表示
function Average(Obj,signal,AnalysisType,TimePoints,varargin)
if nargin==3
ExtSeg=varargin{1};
else
ExtSeg=0;
end
0 件のコメント
回答 (1 件)
Les Beckham
2022 年 2 月 3 日
編集済み: Les Beckham
2022 年 2 月 3 日
What that looks like it is trying to do is to check to see if the caller provided an optional argument and setting the variable ExtSeg equal to the value of that optional argument if it is present or to zero if it is not.
However, since the function has four named arguments already, this probably isn't doing what was intended.
If the test was if nargin == 5 instead, then I believe it would work correctly.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!