Is there any way to access the text of a Simulink DocBlock ?

7 ビュー (過去 30 日間)
Axel Hortsch
Axel Hortsch 2018 年 5 月 7 日
回答済み: liuyan 2020 年 12 月 24 日
Does anybody know a way to access the Text of a Simulink DocBlock in a model via command line, using find_system command ?

採用された回答

TAB
TAB 2018 年 5 月 8 日
編集済み: TAB 2018 年 5 月 8 日
% Find docblocks in model
dBlkH = find_system('MyModel', 'BlockType', 'SubSystem', 'Mask', 'on', 'MaskType', 'DocBlock');
% Extract the docblock text
dBlkUData = get_param(dBlkH(1), 'UserData');
bBlkText = dBlkUData.content;
  2 件のコメント
Axel Hortsch
Axel Hortsch 2018 年 5 月 9 日
Thanks Tabrez, this is helpful ! :-)
If I add a 'FindAll', 'on' it is returning me the Handles to the DocBlocks (otherwise a cell array). I can use either of it.
>> dBlkH = find_system('tl_vwe_model', 'FindAll', 'on', 'BlockType', 'SubSystem', 'Mask', 'on', 'MaskType', 'DocBlock')
dBlkH =
5.0002
8.0002
>> dBlkH = find_system('tl_vwe_model', 'BlockType', 'SubSystem', 'Mask', 'on', 'MaskType', 'DocBlock')
dBlkH =
2×1 cell array
'tl_vwe_model/ChangeHistory'
'tl_vwe_model/Requirements'
I still do not know why this only finds the blocks on top model level (not in the lower subsystem levels).
TAB
TAB 2018 年 5 月 9 日
編集済み: TAB 2018 年 5 月 9 日
Above search command should find the DocBlock in all level of model.
Try to use the 'SearchDepth' option and check there is any difference.

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

その他の回答 (1 件)

liuyan
liuyan 2020 年 12 月 24 日
尝试引用非结构体数组的字段。
出错 Untitled5 (line 31)
bBlkText = dBlkUData.content;

カテゴリ

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