필터 지우기
필터 지우기

Write sigma in uicontrol / text

조회 수: 27 (최근 30일)
Zsolt Lord
Zsolt Lord 2013년 5월 24일
댓글: Image Analyst 2020년 12월 11일
Right now, I'm trying to make a GUI, which calculates a certain sum, and I'd like to write a sigma sign, but for some reason, it's not working.
This is what I tried: uicontrol ('Style','text',... 'String','\sigma_1',... 'FontSize',25,... 'Position', [200 340 100 50]);
If I try copy-pasting a sigma sign off google, it just turns into a '?'.

채택된 답변

Sean de Wolski
Sean de Wolski 2013년 5월 24일
Use an annotation instead of a uicontrol. This offers a text interpreter property:
annotation(gcf,'textbox','String','\sigma_1', 'FontSize',25,'units','pix', 'Position', [200 340 100 50],'Interpreter','Tex');
  댓글 수: 3
patrick mumba
patrick mumba 2016년 5월 18일
please share how you did it
Image Analyst
Image Analyst 2016년 5월 18일
Capitalize sigma:
annotation(gcf,'textbox','String','\Sigma_1', 'FontSize',25,'units','pix', 'Position', [200 340 100 50],'Interpreter','Tex');

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

추가 답변 (2개)

Image Analyst
Image Analyst 2013년 5월 24일

laurent jalabert
laurent jalabert 2020년 12월 11일
편집: laurent jalabert 2020년 12월 11일
For displaying \Theta in a gui
for Style text :
GE = char(hex2dec('03B8')); test = uicontrol('Style','text','String', GE)
For Style list :
GE = char(hex2dec('03B8')); test = uicontrol('Style','list','String', GE)
This is working.
Now, I am using PLOT with ylabel. Those ylabel contains greek characters, displayed correctly since Interpreter Tex is OK.
how can I display an array if ylabell{:} as a Style list in the uicontrol ?
I give an example :
ylabell{1}=('\Theta'); ylabell{2}='\Ree T_i*\gamma [C]' ;
test = uicontrol('Style','list','Position',[100 100 200 100],'FontSize',14,'max',10,...
'min',1,'String', ylabell)
The problem is that Interpreter Tex is not a uicontrol class property. So it is impossible to have the same rendering of the greek character in uicontrol such as in ylabl axis of the graph.
So how to solve this problem when the Style list contains 80 different items containing greek characters ?
If I have to convert each greek character using char(hex2dec(' 03B8')), it is a bit fastidious isn't it ?
Strangely, a possible answer is to copy paste Δ instead of \Delta ... and it works both for ylabel and uicontrol list ...

카테고리

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