Hi,

 

In FreeSurfer 4.3.0, the Matlab routine “freesurfer_read_surf.m” crashes, when run with one output argument:

 

function [vertices, faces] = freesurfer_read_surf(fname)

 

The function help says:

% Note that reading the faces of a quad file can take a long

% time due to their compact storage format.  In this case, the return of

% vertices can be faster if the face output variable is not specified; in

% this case, the faces are not read.

 

However, when the function is called in the form

 

vertices = freesurfer_read_surf(fname),

 

it crashes on line

152 faces = faces + 1;

 

because the variable “faces” is not defined.

 

A quick fix: wrap line 152 inside an if clause:

 

If nargin>1

faces=faces+1;

end

 

Unfortunately I don’t know, how to check, whether this has been fixed in later releases.

 

Cheers,

Matti