Programmatically initialize from source Model workspace

Hi all,
First I want to thanks the community for all the Answers/tips I've been able to find here since I'm using matlab.
I hope this has not been answerd yet.
I've a simulink model where all of my simulink parameters are loaded from a .mat file to the model explorer. When my model is open, if I create a new simulink parameter into my mat file, I will need to "Reinitialize from source" in the model explorer my Model workspace before bein able to build.
Is there a way to add a Pre build/update command that will "Reinitialize from source" ?
Thanks for your help,
Grégoire

 採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 2 月 2 日

1 投票

Try this:
hws = get_param(bdroot, 'modelworkspace');
hws.DataSource = 'MAT-File';
hws.FileName = 'params';
hws.reload;

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePrepare Model Inputs and Outputs についてさらに検索

製品

リリース

R2018b

質問済み:

2021 年 2 月 2 日

コメント済み:

2021 年 2 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by