필터 지우기
필터 지우기

What is the meaning of this code snippet?

조회 수: 2 (최근 30일)
C A
C A 2022년 2월 3일
편집: Les Beckham 2022년 2월 3일
function Average(Obj,signal,AnalysisType,TimePoints,varargin)
if nargin==3
ExtSeg=varargin{1};
else
ExtSeg=0;
end

답변 (1개)

Les Beckham
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.

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by