problems running AFNI commands in MATLAB

Hello! I recently set up afni/suma on my Windows 10 machine using Ubuntu 20.04 and WSL. Both afni and suma are running successfully in Ubuntu.

However, when I try to call afni commands in MATLAB I get the following error:

'3dresample' is not recognized as an internal or external command, 
operable program or batch file.

I thought maybe the abin directory wasn’t adding successfully to MATLAB’s path, but running “path” in matlab shows that my abin directory is there. My abin directory contains the @3dresample file, so I’m lost as to why it isn’t running. Any advice on how to fix this?

Thanks for the help~

some extra notes that might be helpful:

  • I tried using the original location of abin as created by the installation package and got the error, so I copied the entire abin directory to my home directory and tried adding this directory to the path instead. I still got the same error.
  • I tried adding the following line to my ~/ .bashrc file:

export PATH=$PATH:~/abin

  • the code I’m using to add directories to the path in MATLAB is:

oldpath = path;

I’ve also tried the following, but it doesn’t successfully add the directory to the path like I expected…

PATH = getenv('PATH');
setenv('PATH', [PATH ':\Users\kimbe\abin']

Are you trying to run Matlab on the Windows side or the Linux side (inside WSL)? I don’t know there is a good solution if you want to call afni programs from Matlab under Windows, but you should be able to get this to work under WSL. You need to set Matlab to use a shell you want or configure the shell it uses to use the right PATH environment variable. I believe the Matlab path that one typically configures for Matlab search paths is independent of that PATH environment variable, so you will need to configure that.,161444,161484#msg-161484

It’s a bit difficult now to try Matlab configurations for me, so this may require some experimentation on your part.