Back to the main page.

Bug 2156 - ft_megplanar.m fails when there is a channel label with less than 3 characters

Reported 2013-05-06 15:35:00 +0200
Modified 2013-05-09 14:04:52 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 critical
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Giorgos Michalareas - 2013-05-06 15:35:55 +0200

Created attachment 474 the datafile contains variables tmpdata and neighbours If I run the following load bugdatafile tmpdata neighbours cfg = [];'no'; cfg.planarmethod = 'sincos'; cfg.neighbours= neighbours; dataplanar = ft_megplanar(cfg, tmpdata); I get the following error Error message: Error in ft_megplanar (line 301) if strcmp(tmplabel{k}(end-2:end), '_dV') || strcmp(tmplabel{k}(end-2:end), '_dH') If there is in the labels a channel called A2 this fails because tmplabel{k}(end-2:end) does not exist. So the way I see that it could be tackled is to modify the the code at line 301 to something like if length(tmplabel)>2 if strcmp(tmplabel{k}(end-2:end), '_dV') || strcmp(tmplabel{k}(end-2:end), '_dH') tmplabel{k} = tmplabel{k}(1:end-3); end end

Jan-Mathijs Schoffelen - 2013-05-06 20:14:57 +0200

Aha, the problem occurs if the channel set is not full. I patched it by replacing the strcmp with a ~isempty(strfind Bug fixed in revision 8103

Giorgos Michalareas - 2013-05-07 15:38:37 +0200

The ft_megplanar is not working after the above correction. An "end" is missing

Jan-Mathijs Schoffelen - 2013-05-09 09:28:29 +0200

I cannot reproduce this

Giorgos Michalareas - 2013-05-09 13:23:14 +0200

SVN merged the new fieldtrip version with the older version and removed a few lines (I selected chose remote version in conflicts but still did it). Not fieldtrip issue. Thank you

Jan-Mathijs Schoffelen - 2013-05-09 14:04:52 +0200