Questions about the code of EEGLAB.
조회 수: 1 (최근 30일)
이전 댓글 표시
The code below is from EEGLAB. Could anyone tell me how the code works?I met a problem when I entered the input of frequency. Is there any limitations?
if ~isempty(varargin)
if ~ischar(varargin{1})
varargin = { varargin{:} [] [] };
if all(varargin{1} > 0)
options = { 'components' varargin{1} 'freqrange' varargin{2} };
else
options = { 'channels' -varargin{1} 'freqrange' varargin{2} };
end
else
options = varargin;
end
else
options = varargin;
end
댓글 수: 7
Adam Danz
2021년 8월 17일
편집: Adam Danz
2021년 8월 17일
Always share the entire error message when you're asking about an error.
The code you shared is merely setting up options that are likely used as inputs elsewhere in the code. The options depend on what the user provided. You may want to contact the developers of the software for support.
답변 (1개)
Walter Roberson
2021년 8월 17일
The code posted exists for backwards compatibility. At present, the primary way of passing in information to the function is by name/value pairs.
But at some point in the past, the code instead had the possibility of passing in two numeric parameters. In the case that the first numeric parameter was entirely positive, then it was to be interpreted as "component" information, and the second parameter was to be interpreted as frequency range information. In the case that the first numeric parameter was negatie, then its negative was to be interpreted as channel selection, and the second parameter was (still) to be interpreted as frequency range information.
The code would mostly have no effect if it was called with name/value pairs. If it was called with numeric values, then Yes, it would have effect -- but the effect of the section posted would be the same for 1 30 as it would be for 8 13.
There could be bugs in later code from the same function. I observe an oddity for a case involving passing in empty arguements, but I suspect that the oddity might be deliberate.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!