如何从MAtlab运行Python代码 [英] How to run Python code from MAtlab

查看:663
本文介绍了如何从MAtlab运行Python代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个代码;一个在Matlab中,另一个在Python中。

我需要做的是从Matlab运行Python。


我知道我可以使用SYSTEM''....''命令,但它只是在python终端中打开.PY而不是自己运行它。


当我调用python脚本时它会自动运行!

有什么建议吗?

解决方案

你究竟用什么作为系统命令?


它应该是python yourfile.py,对吧?


@Glenton


嘿!
MATLAB中的



system(''abc .py'')


它用abc.py打开Python终端,但为了运行它我必须自己运行它。


@ dima81


尝试


system(''python abc.py'')

I have 2 codes; one in Matlab and the other in Python.
what i need to do is run the Python from Matlab.

I know that i can use SYSTEM''....'' command, but it is only openning the .PY in the python terminal and not running it itself.

I need that when i call python script it will run automatically!
Is there any suggestions?

解决方案

What exactly are you using as the system command?

It should be "python yourfile.py", right?


@Glenton
hey!
in MATLAB:

system(''abc.py'')

it is openning the Python Terminal with the abc.py, but to in order to run it i have to run it myself.


@dima81
Try

system(''python abc.py'')


这篇关于如何从MAtlab运行Python代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆