필터 지우기
필터 지우기

How to bulk add model argument values to a referenced model

조회 수: 1 (최근 30일)
João Araújo
João Araújo 2021년 5월 5일
답변: Sanman 2021년 5월 5일
Hello,
I am trying to add model argument values to referenced models. Because of the amount of arguments in these models, it is not practical to add them by hand.
I would like to know if there is a way to add them programatically, or better yet, paste a table of values on the fields below.
Thank you in advance.

답변 (1개)

Sanman
Sanman 2021년 5월 5일
Hi Joao,
If I understand correctly, you’re trying to update the model reference instance parameters from the Block Parameters dialog. Copy pasting table content might not possible on this dialog, but you can achieve this programmatically.
InstanceParameters” of the model reference block can be manipulated programmatically. Below is a small example:
>>values = {'1','43','23','123'};
>>instanceParams = get_param(gcb,"InstanceParameters");
>>for i = 1:4
instanceParams(i).Value = values{i};
end
>>set_param(gcb,"InstanceParameters", instanceParams);
You can refer to this documentation page for more info. https://www.mathworks.com/help/simulink/ug/parameterize-referenced-models-example.html

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by