Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用pymatbridge连接matlab和python_Python_Matlab - Fatal编程技术网

使用pymatbridge连接matlab和python

使用pymatbridge连接matlab和python,python,matlab,Python,Matlab,当我试图使用pymatbridge将python与matlab连接时,我得到了以下错误 MATLAB started and connected! Traceback (most recent call last): File "pscript.py", line 4, in <module> res = mlab.run('/home/GuestAccounts/Intern002/FingerPrint/fingerprintnew.m') AttributeErro

当我试图使用pymatbridge将python与matlab连接时,我得到了以下错误

MATLAB started and connected!
Traceback (most recent call last):
  File "pscript.py", line 4, in <module>
    res = mlab.run('/home/GuestAccounts/Intern002/FingerPrint/fingerprintnew.m')
AttributeError: 'Matlab' object has no attribute 'run'
提前感谢。

根据,您应该使用:

res = mlab.run_func('../file.m')

非常感谢您的回答,现在它显示了raisevalueerror(“没有可以解码的JSON对象”)ValueError:没有可以解码的JSON对象几乎我没有测试这个库。我只是快速浏览了一下文档,发现您使用了错误的方法:),但我怀疑返回的值没有正确地用JSON编码。据我所知,这个包在MATLAB端运行一个TCP服务器,并使用JSON对消息进行编码。在正常的MATLAB会话中运行
fingerprint new.m
函数时,它会返回什么?实际上,该函数将读取两个指纹图像,提取细节点并将其保存在文本文件中。我没有给任何回报。。我能给出什么?在这种情况下,我认为您应该调用它而不需要任何返回值:
mlab.run_fun(“…”)
。。也许在从Python调用代码之前,您应该先熟悉代码在MATLAB中的工作方式
res = mlab.run_func('../file.m')