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

  • Context: MATLAB 
  • Thread starter Thread starter Ephant
  • Start date Start date
  • Tags Tags
    Fft
Click For Summary

Discussion Overview

The discussion revolves around the use of the EEGLAB toolbox in MATLAB for generating a Welsh FFT plot from EEG data in GDF format. Participants are addressing issues related to function outputs and input data formatting when using the spectopo function.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes the process of loading EEG data and attempting to generate a Welsh FFT plot using the spectopo function, encountering an error related to too many output arguments.
  • Another participant suggests checking the specifications of the spectopo function to determine the correct number of return values, noting that using nine outputs resulted in an error while using five did not.
  • Several participants confirm that the spectopo function is expected to return five output arguments, but one participant reports that even using five outputs still results in an error.
  • A participant raises a question about the Welsh plot's advantages over the FFT, implying that it may reveal more information in certain areas.
  • Another participant recommends using the "help spectopo" command to clarify the expected return values and suggests that discrepancies may arise from version differences of the spectopo function.
  • Concerns are raised about the input data format, with one participant indicating that the ALLEEG variable might not be in the expected format for the spectopo function.

Areas of Agreement / Disagreement

Participants generally agree on the need to verify the number of output arguments for the spectopo function, but there is disagreement regarding the nature of the errors encountered, particularly about input data formatting and function specifications. The discussion remains unresolved regarding the specific cause of the errors.

Contextual Notes

There are indications that the spectopo function may have been updated, leading to discrepancies between the expected and actual behavior. Participants mention the possibility of version differences affecting the function's output and input requirements.

Ephant
Messages
147
Reaction score
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
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.
 
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   Reactions: jedishrfu
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.
 
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...
 
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

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 3 ·
Replies
3
Views
11K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 8 ·
Replies
8
Views
2K