Dear Markus,
MATLAB doesn't seem to end up with the same paths and environment
as the calling user. Hence stuff like this is slightly painful. We have a
solution in save_avw_hdr.m which should work though. Just take the
following lines and modify them for the appropriate FSL command (as
opposed to fslcreatehd which is being called here).
tmp=sprintf('sh -c ". ${FSLDIR}/etc/fslconf/fsl.sh; FSLOUTPUTTYPE=NIFTI_PAIR; export FSLOUTPUTTYPE; $FSLDIR/bin/fslcreatehd %d %d %d %d %6.4f %6.4f %6.4f %6.4f 0 0 0 %d %s"',dims(1),dims(2),dims(3),dims(4),vsize(1),vsize(2),vsize(3),vsize(4),dtype,fname);
system(tmp);
We've found this is necessary to ensure the correct environment
gets set up on all platforms.
All the best,
Mark
On 25 Jan 2012, at 19:25, Markus Gschwind wrote:
> Dear experts!
>
> I am new in Mac and I am wondering why I cannot run fsl commands using a system command (as I always did both in Windows and Linux).
> Can anybody help me please?
>
> Fsl command is not running:
>
> >> system('fslhd beta_0001.hdr')
> /bin/bash: fslhd: command not found
>
> ans =
>
> 127
>
> ... while simple unix commands are possible:
>
> >> system('ls SPM*')
> SPM.mat
>
> ans =
>
> 0
>
> FSLDIR is in the paths:
>
> >> which read_avw.m
> /Applications/fsl/etc/matlab/read_avw.m
>
> What is the problem? Does anybody know?
>
> Thanks in advance!
> Markus
|