Questions about the code of EEGLAB.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Adam Danz
il 17 Ago 2021
Modificato: Adam Danz
il 17 Ago 2021
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.
Risposte (1)
Walter Roberson
il 17 Ago 2021
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 Commenti
Vedere anche
Categorie
Scopri di più su Electrical Block Libraries in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
