フィルターのクリア

Changes in python function does not reflect in Simulink.

2 ビュー (過去 30 日間)
Oindrilla Dutta
Oindrilla Dutta 2022 年 1 月 12 日
回答済み: Erfan Tajalli 2022 年 9 月 2 日
I have a simulink model that contains a matlab function, which instead calls a python function (test) in a python file (py_sim_test.py) using the following code.
function x = myfcn(u)
x = 0;
coder.extrinsic('py.py_sim_test.test')
x = py.py_sim_test.test(u);
end
The python function (test) performs some basic numeric operation. I am able to run the simulation with desired output. But if I change the numeric operation in the python function, then this change is not reflected when I run the simulation again.

回答 (1 件)

Erfan Tajalli
Erfan Tajalli 2022 年 9 月 2 日
I have the same problem as well. If you do not necessarily need to run your Python code as "coder.extrinsic", the "pyrunfile(filename.py)" can solve this problem. If not, you need to restart MATLAB every time you change the Python code. If you do not want to restart MATLAB manually every time, you can use this few lines of code in your .m file:
https://www.mathworks.com/matlabcentral/fileexchange/101470-restart-matlab

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by