How do I refresh reference model blocks programmatically?

6 ビュー (過去 30 日間)
Trilok
Trilok 2025 年 4 月 21 日
編集済み: Walter Roberson 2025 年 4 月 22 日
I have a Simulink model with many "Model" blocks. I have to frequently refresh each of these blocks by right-clicking on the block, hovering over "Subsystem & Model Reference", and then clicking on "Refresh Selected Model Block". Is there a way I can update "Model" blocks programmatically?
I'm Using MATLAB 2016b.

回答 (1 件)

Yoshi Minagawa
Yoshi Minagawa 2025 年 4 月 21 日
編集済み: Walter Roberson 2025 年 4 月 22 日
Hi Trilok,
It appears that an API for this operation is not available in R2016b. However, I think you can achieve a similar effect by updating the entire model using the following command:
set_param(gcs, 'SimulationCommand', 'update')
Starting from R2020a, the Simulink.ModelReference.refresh command is available, which allows you to update a specific model block as shown below:
modelBlocks = find_system(gcs, 'BlockType', 'ModelReference')
Simulink.ModelReference.refresh(modelBlocks{1})

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by