Error: /bin/bash: matlab: command not found when try to start matlab from a jupyter notebook

Viewed 78

i'm new here and i'm a bit frustrated cause of the in the title mentioned error. Probably it's something easy but i'm a linux beginner... I use Linux Mint 20.3, have installed Jupyter notebook via anaconda.

I try to start a matlab file from a jupyter notebook via: !MATLAB and get the error:

/bin/bash: MATLAB: command not found

I tried to set a new environmental variable in the linux shell via:

echo "alias MATLAB=/home/strom/Documents/MATLAB/bin/matlab" >> ~/.bashrc

like i found on this site: https://www.cdslab.org/paramonte/notes/troubleshooting/bash-matlab-command-not-found/

Now i can start Matlab when i type MATLAB i the shell, but not via jupyter notebook.

Thannks for your help!

1 Answers

I wouldn't use an alias here, instead, try modifying your PATH to include the folder with the matlab binary, by writing this in your .bashrc instead.:

export PATH = $PATH:"/home/strom/Documents/MATLAB/bin/"

After that, the problem should be resolved after logging out and back in or after rebooting your PC.

If you then launch Jupyter, the PATH variable is changed, making Jupyter search for matlab in /home/strom/Documents/MATLAB/bin/, where it is located.

Related