Back to the main page.

Bug 1941 - ft_scalpcurrentdensity crashes if elec does not contain (optional) elecpos field

Reported 2013-01-22 10:08:00 +0100
Modified 2014-01-29 13:28:29 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Eelke Spaak
Depends on:
See also:

Jim Herring - 2013-01-22 10:08:59 +0100

ft_scalpcurrentdensity crashes when using an elec structure that does not contain an elecpos field (for example when using a template layout). The reason is that ft_scalpcurrentdensity attempts to clean-up the elec structure in lines 123-128: " % remove all junk fields from the electrode array tmp = elec; elec = []; elec.chanpos = tmp.chanpos; elec.elecpos = tmp.elecpos; elec.label = tmp.label; " This, however, requires the existence of an elecpos field, which seems to be optional to me. Suggested solution: replace "elec.elecpos = tmp.elecpos;" with "if isfield(tmp,'elecpos');elec.elecpos = tmp.elecpos; end;"

Eelke Spaak - 2013-01-23 14:03:25 +0100

Fixed in rev 7380, thanks to Jim.

Eelke Spaak - 2014-01-29 13:28:29 +0100

changing lots of bugs from resolved to closed.