Use of set_param inside an embedded Matlab function: delay observed

Hello,
I want to modify the value of a gain during simulation using the simple enclosed simulink model and including the following Matlab function (previously EML).
function ChangeParam(time)
coder.extrinsic('set_param');
coder.extrinsic('num2str');
if time == 10,
set_param('untitled1/Constant','Value',num2str(1));
end
Modification occurs but at time t=11 sec (sample time = 1sec) whereas I would like the modification to occur at time = 10 sec.
Is there a way to ensure that modification occurs at the current cycle? Is there a way to ensure that the Matlab function runs before the computation that uses the constant block?
Regards,

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2016 年 3 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by