[~,~,~,~,~,~,~,~,spec] Too many output arguments...

  • MATLAB
  • Thread starter Ephant
  • Start date
  • Tags
    Fft
  • #1
Ephant
147
2
Background:

https://sccn.ucsd.edu/eeglab/index.php

"EEGLAB is an interactive Matlab toolbox for processing continuous and event-related EEG, MEG and other electrophysiological data incorporating independent component analysis (ICA), time/frequency analysis, artifact rejection, event-related statistics, and several useful modes of visualization of the averaged and single-trial data. EEGLAB runs under Linux, Unix, Windows, and Mac OS X."

Well. I need to use Welsh FFT plot using my 1000Hz bandwidth data (GDF format) and the EEGlab running under Matlab can load it and then use its ALLEEG variable to do the Welsh plot (like FFT without the noise floor detail and using other ways of computing the bins).

I found this website and tried following the codes for plotting Matcad FFT Plot using ALLEGG in EEGLab

https://devcodef1.com/news/1232023/matlab-fft-plot-alleeg

After loading EEGlab and the GDF data. I tried running the codes in the web site:

Code:
ALLEEG = pop_loadset('ALLEEG.set');
chans = find(strcmp(ALLEEG.chanlocs(:,3),'1'));
[~,~,~,~,~,~,~,~,spec] = spectopo(ALLEEG,chans,1,256,1);
plot(spec.freq,spec.powrel);
xlabel('Frequency (Hz)');
ylabel('Power');

But the codes returned errors (see attachments)

"Error using spectopo Too many output arguments."

When I changed the [~,~,~,~,~,~,~,~,spec] to [~,~,~,~,spec]. No more error. Why is there no more error with only 4 "~,"?
Instead there is another error: (see screenshot).

error using spectopo.JPG



When I checked out line 224. Here is the inside of it.


spectopo line 224.JPG




What kind of error is that and how do you fix that?

Thank you.
 
Physics news on Phys.org
  • #2
Look up the specs for that function spectopo to see how many return values get returned. When you specified nine it gave you the error. When you specified five it didnt. I think the tildes say ti ignore that return value.
 
  • #3
Code:
% Usage:
%              >> spectopo(data, frames, srate);
%              >> [spectra,freqs,speccomp,contrib,specstd] = ...
%                    spectopo(data, frames, srate, 'key1','val1', 'key2','val2' ...);
The function has five output arguments.
 
  • Like
Likes jedishrfu
  • #4
DrClaude said:
Code:
% Usage:
%              >> spectopo(data, frames, srate);
%              >> [spectra,freqs,speccomp,contrib,specstd] = ...
%                    spectopo(data, frames, srate, 'key1','val1', 'key2','val2' ...);
The function has five output arguments.

Even if I used 5 arguments. It is produced the error

spectopo error.JPG



Here is the google drive file of the *.GDF file saved using BCI2000. I just couldn't load it using the codes above. This weekend if you have time, kindly check how to load it up in the codes above I saw in the web site because I just couldn't run it. EEGlab is freely available at https://eeglab.org/others/How_to_download_EEGLAB.html



Btw... Welsh plot can make you see more in some areas that the FFT won't show? Because there seems to be more processing in the Welsh Bins.

Thanks.
 
  • #5
Have you been able to try the "help spectopo" command line prompt?

It should tell you more definitively what the expected return vector is. This may be a vendor or version issue, i.e., you're seeing the Spectopo online reference for a different version of Spectopo than the one you are using.

With respect to line 224, the if expression indicates it has something to do with the "data" variable being non-numeric. This might imply that the inputs you give to spectopo are somehow suspect ie bad data, or wrong dimensions or wrong values...
 
  • #6
The second error is about the input. In your case that is the 'ALLEEG' variable. It is some numerical data but apparently spectopo expects something else (a structure?)

Anyway, if you type
>> help spectopo

Or look at the top of the spectopo.m file (which is the same...) you should be given more hints on how the input data should be formatted. Probably the spectopo function got updated but the example did not...
 

Similar threads

Back
Top