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

  • #1
Ephant
148
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...
 

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
164
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
15K
Back
Top