Hi Barbara,

You haven't told us which OS you use. 
For example in Mac OS it is necessary to start up MATLAB by typing matlab into the X11 terminal, otherwise the system OS will not recognize the commands given via matlab (e.g. system('mycommand') .)

Best,
Markus

2014-09-09 13:45 GMT+02:00 Barbara Kreilkamp <bakk.hbg@googlemail.com>:
Dear Freesurfers,

Is there a way of calling freesurfer-scripts from within MATLAB?
I know there are some setups needed to make MATLAB understand where it can find the commands (I have done this before with FSL). 
I am using bash, and when I type the Freesurfer commands in a terminal by hand, they work. So I am guessing it must have to do with setting up the environment:

freesurf_path ='Applications/freesurfer';
setenv('FREESURFDIR',freesurf_path)

setenv('FREESURFOUTPUTTYPE','NIFTI_GZ')
curpath = getenv('PATH');
setenv('PATH',sprintf('%s:%s',fullfile(freesurf_path,'bin'),curpath));

Thanks a lot for any help,
Barbara

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.