Matlabのedi​terでPython​Scriptを変更し​、実行しても変更した​PythonScri​ptが反映されません​。

Matlab
 mod = py.importlib.import_module('Sample01');
 result = mod.function(5,2);
 disp(result)
Python
 def function(a,b):
return a + b
実行すると
 7 
Pythonを変更
 def function(a,b):
return a - b
実行すると
 7
MatlabのエディターでPythonの内容を変更しても反映されません。
Matlab自体を再起動すると変更内容が反映されます。
メニューの方にもソースを更新するようなものが見当たりません。
使用しているMatlabは、R2021bのトライアルバージョンです。
使用しているPythonは、3.8.10、OSはWindows10です。
よろしくお願いいたします。

2 个评论

「変更されたユーザー定義 Python モジュールの再読み込み」は参考になりませんか?
参考になりました。
reloadが必要なんですね。
助かりました、ありがとうございます。

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB の Python ライブラリ 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!