Print

Print


Hi Xuelin,

Just seen your new post, but I think the error message is clearer in 
this one, and almost certainly from the same problem:

> system(['sh -c "FSLOUTPUTTYPE=NIFTI_PAIR; export FSLOUTPUTTYPE; $FSLDIR/bin/avwmaths ', fname, ' ', tmpname,'"']);
[...]
> "sh; line 1: /bin/avwmaths: No such file or directory"

The error shows that $FSLDIR/bin/avwmaths expanded to just 
/bin/avwmaths, or in other words that $FSLDIR is not set.

You probably need to run something like this first:
  system(['sh -c "source /path/to/your/fsldir/etc/fslconf/fsl.sh"']);

Or maybe just start Matlab after you have set-up FSL in the terminal 
window.

Hopefully after that, something like
   system('echo $FSLDIR');
should show the right location for FSL.

For example, if I run the following lines:
  fslsh = '/my/path/to/fsl/etc/fslconf/fsl.sh';
  cmd = 'avwstats++ $FSLDIR/etc/standard/avg152T1 -x';
  system(['sh -c "source ' fslsh '"']);
  [stat out] = system(['sh -c "' cmd '"'])

I get the result:
  status = 0
  output = 77 76 14

Hope that helps,
Ged