ucdavis / erplab

ERPLAB Toolbox is a free, open-source Matlab package for analyzing ERP data. It is tightly integrated with EEGLAB Toolbox, extending EEGLAB’s capabilities to provide robust, industrial-strength tools for ERP processing, visualization, and analysis. A graphical user interface makes it easy for beginners to learn, and Matlab scripting provides enormous power for intermediate and advanced users.
http://erpinfo.org/erplab
270 stars 73 forks source link

Error when running grand average #46

Open jasonarita opened 8 years ago

jasonarita commented 8 years ago

Description

[via email: Tara Miskovich]

I am running into some trouble trying to create a grand average for my contra and ipsi erps.

This is the error I can when I try and run. Any insight would be a big help. I can no problem when I create and contra-ipsi erp from these same erps.

pop_gaverager(): For file-List, user selected /media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/Scripts/oppovsame_contra_IpsiN39listTara.txt
For file-List, user selected /media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/Scripts/oppovsame_contra_IpsiN39listTara.txt
Loading /media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/4006/4006_contraIpsi_ERPs.erp...
 1) Including 4006_contraIpsi_ERPs...
{ Error using <a href="matlab:helpUtils.errorDocCallback('plus')" style="font-weight:bold"> + </a>
Matrix dimensions must agree.

Error in <a href="matlab:helpUtils.errorDocCallback('gaverager', '/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/functions/gaverager.m', 236)" style="font-weight:bold">gaverager</a> (<a href="matlab: opentoline('/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/functions/gaverager.m',236,0)">line 236</a>)
        naccepted = naccepted + countbinOK;                       % cumulative sum of weights: Sum(wi)

Error in <a href="matlab:helpUtils.errorDocCallback('pop_gaverager', '/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/pop_functions/pop_gaverager.m', 295)" style="font-weight:bold">pop_gaverager</a> (<a href="matlab: opentoline('/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/pop_functions/pop_gaverager.m',295,0)">line 295</a>)
[ERP serror msgboxText ] = gaverager(ALLERP, lista, optioni, erpset, nfile, wavg, stderror, artcrite,
exclunullbin, warn);

Error in <a href="matlab:helpUtils.errorDocCallback('pop_gaverager', '/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/pop_functions/pop_gaverager.m', 169)" style="font-weight:bold">pop_gaverager</a> (<a href="matlab: opentoline('/media/LarsonDrive/NON-MRI6/EEG/studies/Danny_Attention_Shock/eeglab10.2.2.4a/eeglab10.2.2.4b/plugins/erplab_4.0.2.3/pop_functions/pop_gaverager.m',169,0)">line 169</a>)
                        [ERP, erpcom]  = pop_gaverager(ALLERP, 'Erpsets', erpset,'Criterion', artcrite, 'SEM',
                        stdsstr,...
}  
Error while evaluating uimenu Callback


Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]


Expected behavior:

[What you expected to happen]


Actual behavior:

[What actually happened]


Versions

OS version [fill in]
Matlab version [fill in]
EEGLAB version eeglab10.2.2.4b
ERPLAB version erplab_4.0.2.3
jasonarita commented 8 years ago

From the error message Tara provided, one possibility is that the error occurs in gaverager.m (line 252) when adding 2 vectors of different dimensions.

...
        if length(naccepted)==length(countbinOK)
            naccepted    = naccepted + countbinOK;                      % cumulative sum of weights: Sum(wi)
            auxnaccepted = auxnaccepted + auxbinok;                      % ###
...

This can occur when naccepted is a 1x4 matrix while countbinOK is a 4x1 matrix (or vice-versa)

It'll pass the check on line 251, if length(naccepted)==length(countbinOK) because the function length provides the longest dimension. However, a dimension mismatch error can still occur when trying to add a 1x4 matrix to a 4x1 matrix.

jasonarita commented 8 years ago

I emailed Tara:

One quick fix you could do is to update to the latest version of ERPLAB v5.0.0.0 (and perhaps the latest EEGLAB as well) We added various bug fixes that might solve your problem. If you still run into the error though, just let us know.

And Tara replied

so it ran through on the new version, but I got a warning:

naccepted field size does not match the number of current bins In gaverage at 264 In pop_gaverager at 295 In pop_gaverage at 169