How can I type in Greek letter like α or β in MATLAB while I have tried \alpha and \beta ?THANKS!

조회 수: 412 (최근 30일)
I don't konw how to type in Greek letter like α and β in MATLAB ,and I have tried the tip ---- \alpha \beta----however,it doesn't work.
THANKS!
>> \alpha \alpha ↑ 错误: 运算符的使用无效。
>> \Beta \Beta ↑ 错误: 运算符的使用无效。
  댓글 수: 2
DGM
DGM 2023년 9월 16일
편집: DGM 2023년 9월 16일
If your goal is to print the character in the command window or in a figure title/label/legend, then the given answers should work. If necessary, a quick websearch can rustle up whatever variant you want
Considrering the first link with the UTF16 point 0x03DF,
char(hex2dec('03D5'))
ans = 'ϕ'
If your goal is to use phi in the code (e.g. as a variable name), then no, that's not an option.
ϕ = 1234; % this is not a valid character for the code itself
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.

댓글을 달려면 로그인하십시오.

답변 (4개)

Aquatris
Aquatris 2018년 6월 29일
You can simply copy the character.
display('α')
ylabel('α')
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 6월 29일
Unfortunately, MS Windows got the ability to display these characters to the command window relatively late. I am not certain when they were added.
The ability to use them in labels in that form requires R2014b or later, and requires that the interpreter for the text object be either 'none' or 'tex'. Unfortunately you cannot use these characters with interpreter 'latex'.
Aquatris
Aquatris 2018년 6월 29일
Thanks for the clarification Walter. I will also keep it in mind.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2018년 6월 29일
  댓글 수: 6
Walter Roberson
Walter Roberson 2022년 4월 15일
You need to execute in Live Script to see the formatted characters.

댓글을 달려면 로그인하십시오.


mohammad mortezaie
mohammad mortezaie 2021년 8월 3일
In "more properties" in "Text" change interpreter as "tex"
  댓글 수: 2
Diaa
Diaa 2021년 12월 13일
would you share a screenshot of where I can find this property?
Walter Roberson
Walter Roberson 2021년 12월 13일
Assuming that you have a newer version of MATLAB:
In the case that you want to change the interpreter for an axes label:
Click on the axes label you are interested in. Then use the Figure menu item Edit -> current object properties to bring up the Property Inspector. In the Ticks section, click on the downward-pointing triangle that is below "YTickLabel" in order to show more Ticks properties. Scroll down there and you will see TickLabelInterpreter and a drop-menu there to change it
In the case that you want to change the interpreter for something written on the plot using text():
Click on the text you are interested in. Then use the Figure menu item Edit -> current object properties to bring up the Property Inspector. In the TEXT section (near the top), you will see Interpreter and a drop menu there to change it.
If you have an older version of MATLAB, the details might be different (for example it was different around 2016)

댓글을 달려면 로그인하십시오.


Kuldeep Meena
Kuldeep Meena 2021년 10월 29일
\alpha

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by