Hi freesurfers!


I'm trying to run the function write_surf in matlab, as far as I understand this function is to write a surface to analyze in freesurfer from matlab data. I'm not sure if the extension of the file name has to be different, so I need your help to solve this simple (I guess) problem.

The first line is what I'm trying to run and the next lines show me the error.


write_surf('prueba.nofix/', vertices, faces);

...subtracting 1 from face indices for FreeSurfer compatibility.
Error using fwrite
Invalid file identifier.  Use fopen to generate a valid file identifier.

Error in fwrite3 (line 29)
fwrite(fid, b1, 'uchar') ;

Error in write_surf (line 38)
fwrite3(fid, TRIANGLE_FILE_MAGIC_NUMBER);


thank you in advance for your help!
Dulce