从 Matlab 调用 Python
Call Python from Matlab
我需要从 Matlab 调用这些 Python 函数。像这样:
matplotlib.pyplot
matplotlib
numpy
但我不知道如何开始。例如,我在我的电脑上安装了 Python 但没有帮助等......我需要从头开始学习
我也看下面 link 但没有帮助:(
Call Python function from MATLAB
您需要从终端打开 Matlab :
转到回收站:
cd /Applications/MATLAB_R2019a.app/bin/
打开它:
./matlab
接下来,要使用 Python,请输入:
!python
此答案假定您已经在系统上安装了 Python。
最近,我为一些硬件设计了一个MATLAB控制器,但是控制硬件的脚本是在Python中编写的。
例如,我在同一工作目录中有一个名为 test.py
的 python 脚本
def hello():
return "Hello World!"
在 MATLAB 中,我可以 运行 这个脚本使用命令:py.test.hello
Image of my MATLAB command window output
这是returns一条友情留言:)
我需要从 Matlab 调用这些 Python 函数。像这样:
matplotlib.pyplot
matplotlib
numpy
但我不知道如何开始。例如,我在我的电脑上安装了 Python 但没有帮助等......我需要从头开始学习 我也看下面 link 但没有帮助:( Call Python function from MATLAB
您需要从终端打开 Matlab :
转到回收站:
cd /Applications/MATLAB_R2019a.app/bin/
打开它:
./matlab
接下来,要使用 Python,请输入:
!python
此答案假定您已经在系统上安装了 Python。
最近,我为一些硬件设计了一个MATLAB控制器,但是控制硬件的脚本是在Python中编写的。
例如,我在同一工作目录中有一个名为 test.py
的 python 脚本def hello():
return "Hello World!"
在 MATLAB 中,我可以 运行 这个脚本使用命令:py.test.hello
Image of my MATLAB command window output
这是returns一条友情留言:)