Set default font settings for Simulink annotation (comments)

Hello,
For improving visibility of model, I would like to change the defaul font for all anotations: I would like to use Courrier New Black 14 pt. How can I do this programmatically?

3 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 10 月 10 日
移動済み: Dyuman Joshi 2023 年 10 月 26 日
Changing the Font properties of the axes works for objects related to the axes (title, labels, etc).
However, for text objects and textbox via annotation, you will have to specify the properties manually.
%Sample plot
fplot(@sin)
xlabel('Input - time')
ylabel('Output - Signal')
title('Sinosuidal Curve')
%Get current axis
ax = gca;
name = 'Courier New';
sz = 14;
ax.FontName = name;
ax.FontSize = sz;
%Manually specifying font for text object
t = text(ax, 0,0,'\rightarrow sin(0)', 'FontName', name, 'FontSize', sz);
Dimitri
Dimitri 2023 年 10 月 10 日
移動済み: Dyuman Joshi 2023 年 10 月 26 日
Hi Joshi!
Thanks, but I meen the annotation for model and not for charts: https://www.mathworks.com/help/simulink/ug/annotate-models.html
Do you know how can I handler all the annotations of model?
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 10 日
移動済み: Dyuman Joshi 2023 年 10 月 26 日
Ah, okay. I should have noticed the product mentioned as "Simulink".
I will get back to you on this soon.

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

 採用された回答

Fangjun Jiang
Fangjun Jiang 2023 年 12 月 14 日
編集済み: Fangjun Jiang 2023 年 12 月 14 日

1 投票

I don't think there is a way to pre-set the default font. But you can do a quick and easy post-processing like this. It will change all the annotations at once.
ano=find_system(ModelName,'FindAll','On','Type','Annotation')
set(ano,'FontName','Arial')
See doc page
web(fullfile(docroot, 'simulink/ug/create-an-annotation-programmatically.html?s_tid=doc_srchtitle'))

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2022a

質問済み:

2023 年 10 月 10 日

編集済み:

2023 年 12 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by