Write in a DocBlock programmaticaly

2 ビュー (過去 30 日間)
Lucas S
Lucas S 2020 年 2 月 24 日
コメント済み: Lucas S 2020 年 2 月 25 日
Hello !
I have a Simulink model with a DocBlock inside and i would like to create a script to write inside this DocBlock. I already have this code :
A = find_system('MyModel', 'BlockType', 'SubSystem', 'Mask', 'on', 'MaskType', 'DocBlock');
B = get_param(A, 'UserData');
B = cell2mat(B);
B.content = 'Test';
disp(B.content);
set_param(string(A), 'UserData', B.content);
The problem is after i run the script if i double click on the DocBlock the data doesn't change i don't know why. Do someone know how to change the content of a DocBlock ?
Edit : I modify a little bit the set_param line and add a get_param line to verify that the change is happening :
set_param(Hndle, 'UserData', B);
C = get_param(Hndle, 'UserData');
And when i display C, it actually display the change but when i double click on the DocBlock it doesn't change the data i really don't understand
Thank you !

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 2 月 25 日
set_param(Hndle, 'UserData', B,'UserDataPersistent','On');
  1 件のコメント
Lucas S
Lucas S 2020 年 2 月 25 日
Thank you !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by