Skip to end of metadata
Go to start of metadata

To run FSL commands in Matlab you need to start Matlab like this:
LD_PRELOAD=/usr/lib64/libstdc++.so.6 <path to Matlab>/matlab

For example:
LD_PRELOAD=/usr/lib64/libstdc++.so.6 /usr/local/Matlab/bin/matlab

Next, within Matlab you need to set up some variables:
fsl_path = '/usr/share/fsl/4.1/';
setenv('FSLDIR',fsl_path)
setenv('FSLOUTPUTTYPE','NIFTI_GZ')
curpath = getenv('PATH');
setenv('PATH',sprintf('%s:%s',fullfile(fsl_path,'bin'),curpath));

Then you call FSL routines like this:
system('sh -c ". ${FSLDIR}etc/fslconf/fsl.sh;${FSLDIR}bin/<FSL command>"')

For example:
system('sh -c ". ${FSLDIR}etc/fslconf/fsl.sh;${FSLDIR}bin/fast -b --nopve mean_func"') 

 

References:

https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0902&L=FSL&D=0&P=348826
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0902&L=FSL&D=0&P=357648
http://www.mathworks.com/matlabcentral/newsreader/view_thread/162466

  • No labels

1 Comment

  1. Recent versions of fsl include a /usr/local/etc/matlab folder - and in that folder, there is a call_fsl.m command. Copy/edit that as described inside that file, and enjoy....