[Eeglablist] pop_rejchan

Tyler Grummett tyler.grummett at flinders.edu.au
Tue Mar 4 21:14:04 PST 2014

Hello eeglab,

Im not sure whether this is a bug or not so I though I should report it on here before submitting the bug.

On line 131 of pop_rejchan:

measure = pop_spectopo(EEG, 1, [0  EEG.xmax*EEG.srate], 'EEG' , 'freqrange', opt.freqrange, 'plot','off');

I was wondering why 0 is chosen as the first input. On line 263 in pop_spectopo:

posi = round( (timerange(1)/1000-EEG.xmin)*EEG.srate )+1;

If timerange(1) = 0 and you subtract EEG.xmin from it then it will generate a negative number, which will end up being a negative index. I think this is the cause for later crashes.

It also seems apparent that the units for timerange are in datapoints. However, when you come to line 262 in pop_spectopo:

if timerange(1)/1000~=EEG.xmin | timerange(2)/1000~=EEG.xmax

It would seem that timerange should be in milliseconds rather than datapoints. Which would mean you would need to make the following change at line 131 of pop_rejchan.

On line 131 of pop_rejchan:

measure = pop_spectopo(EEG, 1, [EEG.xmin  EEG.xmax]*1000, 'EEG' , 'freqrange', opt.freqrange, 'plot','off');

However if 'time range' should be in datapoints, I was wondering whether dividing it by the EEG.srate rather than 1000 is more appropriate at line 262 in pop_spectopo and doing the following at line 131 in pop_rejchan:

measure = pop_spectopo(EEG, 1, [EEG.xmin  EEG.xmax]*EEG.srate, 'EEG' , 'freqrange', opt.freqrange, 'plot','off');?

The function appears to be working fine if you make these changes.




Tyler Grummett ( BBSc, BSc(Hons I))
PhD Candidate
Brain Signals Laboratory
Flinders University
Rm 5A301
Ext 66124
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20140305/d36760e0/attachment.html>

More information about the eeglablist mailing list