Pyhonプログラム​の変更をSimuli​nkシミュレーション​に反映させるには、ど​うすればいいですか?

MATLAB Functionブロック内で、Pythonプログラムを使っています。
Pyhonプログラムを変更後に、Simulinkシミュレーションを実行しても、変更が反映されません。どうすればいいですか?

 Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2024

0 votes

この場合、変更されたPythonモジュールを再読み込みして頂く必要がございます。
下記ドキュメントページの「変更されたユーザー定義 Python モジュールの再読み込み」より、手順をご確認頂けます。
https://jp.mathworks.com/help/matlab/matlab_external/call-user-defined-custom-module.html#buuz303
例えば、お客様の場合、
1)Simulinkシミュレーション後、Pythonプログラムtest.pyの変更
2)MATLABコマンドウインドウ上で
%モジュールのアンロード
>> clear classes
%変更されたモジュールのインポート
>> mod = py.importlib.import_module('test');
%Python でのモジュールの再読み込み
>> py.importlib.reload(mod);
3)Simulinkシミュレーションを実行
の流れになります。

More Answers (0)

Products

Release

R2023b

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!