【发布时间】:2024-01-03 12:57:01
【问题描述】:
我想从 iPython notebook 运行 MATLAB 代码。
我已经安装了以下库:
- ZeroMQ-4.0.4-miru1.0-x64.exe
- pyzmq-14.7.0
- pymatbridge-0.5.2
- matplotlib-1.4.3.win-amd64-py2.7.exe
- python 2.7
我正在尝试将 MATLAB 与 iPython 连接,以便使用以下代码运行 MATLAB 命令:
import sys
sys.path.append('C:\Python27\Lib\site-packages\pymatbridge')
from pymatbridge import Matlab
mlab = Matlab()
mlab = Matlab(executable='C:\Program Files\MATLAB\R2013a\bin\matlab')
mlab.start()
但是,得到了以下消息:
Starting MATLAB on ZMQ socket tcp://127.0.0.1:42987
Send 'exit' command to kill the server
............................................................MATLAB session timed out after 60 seconds
同样在运行%load_ext pymatbridge iPython-magic 命令时返回:
The pymatbridge module is not an IPython extension.
你能帮忙吗?
【问题讨论】:
-
另外,我关注了这些directions 并输入了
%load_ext pymatbridge,这会打开一个 MAtlab 命令窗口,但出现错误Error in matlabserver (line 7) messenger('init', socket_address); -
Q1: 为了找出问题的根本原因,您是否尝试过 python-python zmq-socket 通信来证明 iPython 端的基础设施正常且工作正常? Q2:您是否尝试过使用 MATLAB 进行非 iPython python 解释器会话,以证明观察到的故障与 iPython-(in) 相关性? Q3:您之前有没有使用 MATLAB 进行 pymatbridge 或其他基于 MEX 的独立 zmq-socket 通信的经验?
标签: python matlab ipython ipython-notebook