在python上运行matlab脚本

在python上运行matlab脚本,python,matlab,Python,Matlab,我试图运行一个matlab脚本,在python上计算三角形的面积 Python版本2.7.11 另存为trirea.py的Python脚本: import matlab.engine eng = matlab.engine.start_matlab() eng.triarea(nargout=0) MATLAB版本2015b 保存为triarea.m的Matlab脚本: b = 5; h = 3; a = 0.5*(b.* h) 运行: python trirea.py 但是,当我尝试使用m

我试图运行一个matlab脚本,在python上计算三角形的面积

Python版本2.7.11 另存为trirea.py的Python脚本:

import matlab.engine
eng = matlab.engine.start_matlab()
eng.triarea(nargout=0)
MATLAB版本2015b 保存为triarea.m的Matlab脚本:

b = 5;
h = 3;
a = 0.5*(b.* h)
运行: python trirea.py

但是,当我尝试使用matlab脚本运行python文件时,屏幕上会出现一个错误:

分段错误:11

如果我选择阅读有关错误的更多信息:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                             000000000000000000 0 + 0
1   libpython2.7.dylib              0x0000000104271b17 PyEval_GetGlobals + 23
2   libpython2.7.dylib              0x0000000104295da2 PyImport_Import + 50
3   libpython2.7.dylib              0x0000000104295fd8 PyImport_ImportModule + 40
4   matlabengineforpython2_7.so     0x000000010392fcf7 initmatlabengineforpython2_7 + 23

我不知道该怎么办。请帮忙,谢谢

您没有提到您的用例是。这表明问题在于你的安装,而不是程序。你没有提到你的用例是。这表明问题在于您的安装,而不是程序。