is it possible to personalize the text style in Matlab, such as 'Arial', 'times new romane', etc?
if not, can anyone tell me what is the default text style in Matlab?
Thanks!
Yu

3 件のコメント

Stephen23
Stephen23 2018 年 11 月 17 日
"is it possible to personalize the text style in Matlab..."
Which "text" are you asking about: text in the command window, text in the IDE user interface (e.g. menus, buttons, etc), text in the MATLAB editor, text shown in the Variable Viewer, text viewed dialog boxes, text within graphics objects, etc... ?
Yu Li
Yu Li 2018 年 11 月 17 日
I want have 'Times New Roman' as default style for all situations, but according to Adam's answer I have to set it everytime I run the function.
Adam Danz
Adam Danz 2018 年 11 月 17 日
I don't think you understand the 3rd secton of code in my answer. That section will change the default fontname property. See the comment under my answer for instructions on how to change the font of the IDE (the Matlab user interface).

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

 採用された回答

Adam Danz
Adam Danz 2018 年 11 月 17 日
編集済み: Adam Danz 2018 年 11 月 17 日

4 投票

Set the FontName property. Here are some examples.
title('myTitle', 'FontName', 'Times')
xlabel('myLabel', 'FontName', 'Arial')
set(gca, 'FontName', 'Gotham')
To get a list of available fonts:
listfonts
To set the default fonts,
set(0, 'DefaultAxesFontName', 'Arial');
% or any of the following...
'defaultUicontrolFontName'
'defaultUitableFontName'
'defaultAxesFontName'
'defaultTextFontName'
'defaultUipanelFontName'

9 件のコメント

Yu Li
Yu Li 2018 年 11 月 17 日
I have two further questions:
  1. what is the font name of 'times new romane'.
  2. where can I find the list of available font names
  3. is it possible to set all the font names to be 'times new romane', without setting font names for each situation?
  4. if I use command you provided: set(xx,xx,xx), do I need to use it at the beginning of each functions, or if I type it in MATLAB command window, it will works for every where&time in the future?
Thanks!
Yu
Adam Danz
Adam Danz 2018 年 11 月 17 日
Did you read my answer? Answers to questions 1, 2 and 3 are already in my previous response.
For your 4th question, if you use set() on an object, you need to set the properties after creating the object. If you use set() to set default settings (also in my previous answer) then you need to do that before creating the objects.
Adam Danz
Adam Danz 2018 年 11 月 17 日
編集済み: Adam Danz 2018 年 11 月 17 日
The 3rd second of code in my answer will change the default font name for all future objects after you set the font. For example, if you want all future axes to use font 'Times New Roman', run this line before creating the axes.
set(0, 'DefaultAxesFontName', 'Arial');
If you're trying to set the font for the IDE, go to "preferences" and then "Fonts".
Yu Li
Yu Li 2018 年 11 月 17 日
I tried but does not work. the setting in 'preference' only controls the text in Matlab window, not the figures generated by Matlab.
Adam Danz
Adam Danz 2018 年 11 月 17 日
Once again, to set the default FontName property, you must use the 3rd section of code in my answer.
set(0, 'DefaultAxesFontName', 'Times New Roman');
then create your figure. When 0 is the first input to set(), the default value is set for that property.
Walter Roberson
Walter Roberson 2018 年 11 月 17 日
Note that setting Default* works for the session not permanently .
Adam Danz
Adam Danz 2018 年 11 月 17 日
Yes, if you want to permanently set your defaults, you can add those lines of code to your startup file.
Yu Li
Yu Li 2018 年 11 月 18 日
thank you, I think I have got what I want.
Yu
Adam Danz
Adam Danz 2018 年 11 月 19 日
Glad it worked out!

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

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2018 年 11 月 17 日

コメント済み:

2018 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by