Mac OS doesn't set environment variables up by default for programs launched by double clicking, if you were to launch the MATLAB binary from a BASH shell then you would see these being set (it is possible to set them using a 'plist' file but you don't want to go there…)
We provide a MATLAB helper function 'call_fsl' which will carry out the sourcing of fsl.sh for you (and tidy up some of the library settings that MATLAB enforce and can break FSL and slow things down if NFS is involved). Ubuntu/Debian users should check the source code for this (FSLDIR/etc/matlab/call_fsl.m) to make sure the appropriate sections are uncommented.
All you need to do is ensure that FSLDIR and PATH are setup correctly which you do by making sure the following is in ~/.matlab/startup.m
setenv( 'FSLDIR', '/Volumes/Scratch/duncan-temp/fslinstalltest/fsl' );
fsldir = getenv('FSLDIR');
fsldirmpath = sprintf('%s/etc/matlab',fsldir);
path(path, fsldirmpath);
clear fsldir fsldirmpath;
This should have been done by the installer.
Duncan
On 14 Jun 2013, at 17:40, Anna Greenwald <[log in to unmask]> wrote:
> Thanks everybody for your help! I'm obviously clueless and still haven't gotten it fixed despite all your help, but I've got some more insight:
> If I type
> export
> in my bash terminal window, I get the following output:
> declare -x Apple_PubSub_Socket_Render="/tmp/launch-3gf3KZ/Render"
> declare -x Apple_Ubiquity_Message="/tmp/launch-lLg0UN/Apple_Ubiquity_Message"
> declare -x COMMAND_MODE="unix2003"
> declare -x DISPLAY="/tmp/launch-4z6zzb/org.macosforge.xquartz:0"
> declare -x FSLCONFDIR="/usr/local/fsl/config"
> declare -x FSLDIR="/usr/local/fsl"
> declare -x FSLLOCKDIR=""
> declare -x FSLMACHINELIST=""
> declare -x FSLMACHTYPE=""
> declare -x FSLMULTIFILEQUIT="TRUE"
> declare -x FSLOUTPUTTYPE="NIFTI_GZ"
> declare -x FSLREMOTECALL=""
> declare -x FSLTCLSH="/usr/local/fsl/bin/fsltclsh"
> declare -x FSLWISH="/usr/local/fsl/bin/fslwish"
> declare -x HOME="/Users/anna"
> declare -x LOGNAME="anna"
> declare -x OLDPWD="/Users"
> declare -x PATH="/usr/local/fsl/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/X11/bin"
> declare -x PWD="/"
> declare -x SECURITYSESSIONID="186a4"
> declare -x SHELL="/bin/bash"
> declare -x SHLVL="2"
> declare -x SSH_AUTH_SOCK="/tmp/launch-unTD3D/Listeners"
> declare -x TERM="xterm"
> declare -x TMPDIR="/var/folders/23/jbv5t1x52bq2rm6yc6xhjtvw0000gp/T/"
> declare -x USER="annagreenwald"
> declare -x WINDOWID="6291469"
> declare -x X11_PREFS_DOMAIN="org.macosforge.xquartz.X11"
> declare -x XTERM_LOCALE="C"
> declare -x XTERM_SHELL="/bin/bash"
> declare -x XTERM_VERSION="XTerm(281)"
> declare -x __CF_USER_TEXT_ENCODING="0x1F6:0:0"
>
> Clearly, the fsldir is part of the PATH and FSLOUTPUTTYPE is set.
>
> In contrast, if I type
> system('export')
> into Matlab, I get
> declare -x ARCH="maci64"
> declare -x AUTOMOUNT_MAP=""
> declare -x Apple_PubSub_Socket_Render="/tmp/launch-3gf3KZ/Render"
> declare -x Apple_Ubiquity_Message="/tmp/launch-lLg0UN/Apple_Ubiquity_Message"
> declare -x BASEMATLABPATH=""
> declare -x COMMAND_MODE="unix2003"
> declare -x DISPLAY="/tmp/launch-4z6zzb/org.macosforge.xquartz:0"
> declare -x DYLD_FRAMEWORK_PATH="/Applications/MATLAB_R2013a.app/sys/os/maci64:/Applications/MATLAB_R2013a.app/bin/maci64/../../Contents/MacOS:/Applications/MATLAB_R2013a.app/bin/maci64:/Applications/MATLAB_R2013a.app/extern/lib/maci64:/Applications/MATLAB_R2013a.app/runtime/maci64"
> declare -x DYLD_LIBRARY_PATH="/Applications/MATLAB_R2013a.app/sys/os/maci64:/Applications/MATLAB_R2013a.app/bin/maci64/../../Contents/MacOS:/Applications/MATLAB_R2013a.app/bin/maci64:/Applications/MATLAB_R2013a.app/extern/lib/maci64:/Applications/MATLAB_R2013a.app/runtime/maci64"
> declare -x FSLDIR="/usr/local/fsl"
> declare -x GFORTRAN_STDERR_UNIT="-1"
> declare -x GFORTRAN_STDIN_UNIT="-1"
> declare -x GFORTRAN_STDOUT_UNIT="-1"
> declare -x HOME="/Users/anna"
> declare -x LANG="en_US.ISO8859-1"
> declare -x LC_CTYPE="en_US.ISO8859-1"
> declare -x LC_NUMERIC="C"
> declare -x LOGNAME="anna"
> declare -x MATLAB_USE_USERWORK=""
> declare -x OLDPWD
> declare -x OSG_LD_LIBRARY_PATH="/Applications/MATLAB_R2013a.app/sys/openscenegraph/lib/maci64"
> declare -x PATH="/usr/bin:/bin:/usr/sbin:/sbin"
> declare -x PWD="/"
> declare -x SHELL="/bin/bash"
> declare -x SHLVL="1"
> declare -x SSH_AUTH_SOCK="/tmp/launch-unTD3D/Listeners"
> declare -x TERM="dumb"
> declare -x TMPDIR="/var/folders/23/jbv5t1x52bq2rm6yc6xhjtvw0000gp/T/"
> declare -x TOOLBOX="/Applications/MATLAB_R2013a.app/toolbox"
> declare -x USER="anna"
> declare -x XAPPLRESDIR="/Applications/MATLAB_R2013a.app/X11/app-defaults"
> declare -x XFILESEARCHPATH="/System/Library/Frameworks/JavaVM.framework/lib/locale/%L/%T/%N%S:"
> declare -x XKEYSYMDB="/Applications/MATLAB_R2013a.app/X11/app-defaults/XKeysymDB"
> declare -x __CF_USER_TEXT_ENCODING="0x1F6:0:0"
> declare -x com.apple.java.jvmMode="client"
> declare -x com.apple.java.jvmTask="JNI"
>
> So, you were right, the fsldir is not part of the PATH and FSLOUTPUTTYPE isn't set, at least from Matlab's perspective.
>
> Seems like all I have to do is to set them, but that's where I fail. Matlab doesn't understand setenv and getenv (I guess because I'm using a bash shell), instead giving me the usual "command not found". It doesn't protest at echo and export, but neither does
> system('export FSLOUTPUTTYPE="NIFTI_GZ"')
> have an effect - echo FSLOUTPUTTYPE remains empty. Same for my attempts of using export to edit the PATH variable. It simply stays the same before and after the command.
>
> Any idea why?
>
> Thanks!
> Anna
>
>
>
>
> On Thu, Jun 13, 2013 at 7:35 PM, Daniel Keeser <[log in to unmask]> wrote:
> Hi Anna,
>
> may also try to launch Fsl by typing:
> cmd ='/usr/local/fsl/bin/what_ever_you_like_to_start;
> system(cmd);
>
> and maybe useful too (advice what the output type should be):
> setenv(‘FSLOUTPUTTYPE’, ‘NIFTI_GZ’); (if you like nii.gz or type whatever you like)
>
> Best,
> Daniel
>
|