Programmatically add annotation with a table to simulink

3 ビュー (過去 30 日間)
Wei
Wei 2025 年 4 月 17 日
コメント済み: Wei 2025 年 4 月 24 日
Hey all,
I'm trying to add an annotation to a Simulink model which includes a table. However, no reference code has been found yet.

回答 (1 件)

Jaskirat
Jaskirat 2025 年 4 月 21 日
Hello @Wei
As of now, there is no built-in function to insert actual table objects into Simulink annotations programmatically. However, it is quite convenient to manually insert a table as an annotation by double clicking anywhere on the canvas and selecting “Create Annotation”, and using the “Insert Table” option.
Alternatively, you can simulate a table by formatting annotation text. Following is a sample code snippet for the same:
annotationText = sprintf(['Parameter Value\n', ...
'--------- -----\n', ...
'Gain 5\n', ...
'Offset 2']);
% Add the annotation to the model
a = Simulink.Annotation(model, annotationText);
You can refer to the following documentation links for more details on how to add annotations:
Hope this helps!
  1 件のコメント
Wei
Wei 2025 年 4 月 24 日
Thank you. I will try the method you suggested.

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

カテゴリ

Help Center および File ExchangeModel, Block, and Port Callbacks についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by