我正在处理一个主要由Matlab编写且部分使用Python的系统。 Python脚本是从Matlab中调用的。 我正在寻找一种方便的方式来使用一些集成开发环境(如PyCharm)来调试从Matlab中调用的Python代码。
如果可能的话,我将很高兴收到建议以及如何操作。 操作系统为Windows 10,Matlab版本为R2018b,Python版本为3.6。
我正在处理一个主要由Matlab编写且部分使用Python的系统。 Python脚本是从Matlab中调用的。 我正在寻找一种方便的方式来使用一些集成开发环境(如PyCharm)来调试从Matlab中调用的Python代码。
如果可能的话,我将很高兴收到建议以及如何操作。 操作系统为Windows 10,Matlab版本为R2018b,Python版本为3.6。
.py
文件:# mymod.py
"""Python module demonstrates passing MATLAB types to Python functions"""
def search(words):
"""Return list of words containing 'son'"""
newlist = [w for w in words if 'son' in w]
return newlist
def theend(words):
"""Append 'The End' to list of words"""
words.append('The End')
return words
>> mod = py.importlib.import_module('mymod');
>> N = py.list({'Jones','Johnson','James'});
搜索 MATLAB:
选择 MATLAB 进程并附加。>> py.mymod.search(N)
MATLAB命令窗口将停止运行。前往Visual Studio调试您的代码: