1

The code to run matlab in bash script:

matlab -nodesktop -nosplash -nodisplay -r "run ./myDir/myfile ; quit;"

I have Matlab installed on my computer, however when I run the bash script I get this error:

matlab:not found

I don't know if it is because of the Matlab's path (/home/myComputerName/Documents/MATLAB/bin/matlab) in my computer, which is located under /Documents/.

What causes this problem? If it is because of the path, is there a general solution, i.e. running matlab is independent where it is installed, for this?

13
  • 1
    pls run which matlab or whereis matlab to see if you have matlab in your path and installed in your machine. You can always add /Documents to your PATH if you have matlab there and dnt want to type ./Documents/matlab Commented May 16, 2013 at 4:04
  • Nothing appears! It is interesting because I have matlab installed. Commented May 16, 2013 at 4:06
  • 1
    run this export PATH=$PATH:/Documents/MATLAB/bin/matlab and then run matlab from the cmd prompt. Let me know if this works. Commented May 16, 2013 at 4:10
  • 2
    A directory called /Documents seems unlikely to exist on an Ubuntu install. Are you sure it isn't actually in $HOME/Documents? If so, that needs to go in the path line. Commented May 16, 2013 at 4:19
  • 4
    Try export PATH=$PATH:/home/myComputerName/Documents/MATLAB/bin then Commented May 16, 2013 at 4:24

2 Answers 2

2

The general solution is to add the directory containing the binary to your PATH, or, conversely, to properly install the program so that it appears in a directory which is already included in your PATH. For locally installed software, the standard location is /usr/local/bin.

Typically you would edit your .bashrc and log out and back in to update your PATH.

Sign up to request clarification or add additional context in comments.

Comments

1

Try matlab support, it just solved a lot of my path/launcher related issues

sudo apt-get install matlab-support

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.