Back to the main page.

Bug 3020 - in ft_plot_mesh mesh = fixpos(mesh); is called without checking whether mesh is a structure

Reported 2015-12-03 15:23:00 +0100
Modified 2019-08-10 12:31:30 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: All
Operating System: All
Importance: P5 major
Assigned to:
Depends on:
See also:

Thomas Hartmann - 2015-12-03 15:23:30 +0100

hi, above problem was introduced with git commit 5da3412139c8e6e687b16a7cfc02b8ecba2cc09d. the problematic line is line 61: % rename pnt into pos mesh = fixpos(mesh); if ~isstruct(mesh) && isnumeric(mesh) && size(mesh,2)==3 % the input seems like a list of points, convert into something that resembles a mesh mesh = struct('pos', mesh); end mesh = fixpos(mesh) gets called without typechecks. there are some cases is which mesh is a numeric matrix instead of a structure. this get handled only in lines 63ff. cheers, thomas

Robert Oostenveld - 2015-12-08 08:26:56 +0100

fixpos should work on whatever input it gets, i.e. also empty, Nx3, or struct-array... It should only do something if the input is a struct (or struct-array) with a pnt field. So it is only for ensuring consistency of external (users or higher level FT functions) input. The internal conversion of a Nx3 input into a struct with pos field is not affected. So I don't see the error (i.e. I don't know right now what the acclaimed error is). Perhaps it is merely the expectations that are raised by the name of the function? fixpos is not currently meant to convert Nx3 into a struct.

Thomas Hartmann - 2015-12-08 09:42:44 +0100

(In reply to Robert Oostenveld from comment #1) hi robert, i just saw that the problem was already fixed a few days ago. seems that i missed the commit. sorry. thomas

Robert Oostenveld - 2015-12-08 10:06:42 +0100

good to hear

Robert Oostenveld - 2019-08-10 12:31:30 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on