[英]Runtime Error: Unknown MATLAB location when using a wrapper in python
I am trying to use a Matlab wrapper for my code in the ipython spyder IDE. 我正在尝试在ipython spyder IDE中为我的代码使用Matlab包装器。 I get the following error when I run the code:
运行代码时出现以下错误:
raise RuntimeError("Unknown MATLAB location: try to initialize MatlabSession with matlab_root set properly.")
RuntimeError: Unknown MATLAB location: try to initialize MatlabSession with matlab_root set properly.
I'm hoping this is a simple fix to import a module or change a setting in spyder. 我希望这是导入模块或更改spyder中的设置的简单解决方案。 Or if anyone knows how to set the matlab_root?
或者,如果有人知道如何设置matlab_root? Any help would be much appreciated, Thank You!
任何帮助将不胜感激,谢谢!
Basically matlab_root is a variable inside MatlabSession
, that points to the folder where MATLAB is installed. 基本上matlab_root是内部的可变
MatlabSession
,指向到安装MATLAB的文件夹。 What is happening here is that probably matlab_root has a default value that is not where your MATLAB is installed. 这里发生的情况可能是matlab_root的默认值不在您的MATLAB安装位置。 you need to change/set this variable to the folder where MATLAB is installed.
您需要将此变量更改/设置为安装MATLAB的文件夹。
Set the environment directly in the code, eg (Mac OS) 直接在代码中设置环境 ,例如(Mac OS)
import matlab_wrapper
matlab = matlab_wrapper.MatlabSession(matlab_root='/Applications/MATLAB_R2017b.app')
or try to set the environment variable via command line, eg (again Mac) 或尝试通过命令行设置环境变量 ,例如(再次在Mac中)
echo matlab_root='/Applications/MATLAB_R2017b.app'
Also, see the matlab_wrapper FAQ: https://github.com/mrkrd/matlab_wrapper/blob/master/FAQ.rst 另外,请参阅matlab_wrapper常见问题解答: https : //github.com/mrkrd/matlab_wrapper/blob/master/FAQ.rst
An additional option is to use the native wrapper (matlab-engine) from Mathworks, see here: https://www.mathworks.com/help/matlab/matlab-engine-for-python.html 另一个选择是使用MathWorks的本地包装器 (matlab引擎),请参见此处: https : //www.mathworks.com/help/matlab/matlab-engine-for-python.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.