在 bash 脚本中运行 Matlab;matlab:未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16578722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
running Matlab in bash script; matlab: not found
提问by newzad
The code to run matlab in bash script:
在 bash 脚本中运行 matlab 的代码:
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,但是当我运行 bash 脚本时出现此错误:
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/.
我不知道是不是因为/home/myComputerName/Documents/MATLAB/bin/matlab我电脑中的 Matlab 路径 ( ),它位于 /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?
是什么导致了这个问题?如果是路径的原因,有没有通用的解决方案,即运行matlab是独立于安装的地方,为此?
回答by tripleee
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.
一般的解决方案是将包含二进制文件的目录添加到您PATH的PATH. 对于本地安装的软件,标准位置是/usr/local/bin.
Typically you would edit your .bashrcand log out and back in to update your PATH.
通常,您会编辑您的.bashrc并注销并重新登录以更新您的PATH.
回答by esperluette
Try matlab support, it just solved a lot of my path/launcher related issues
尝试 matlab 支持,它刚刚解决了我的很多路径/启动器相关问题
sudo apt-get install matlab-support

