フィルターのクリア

How can I write Greek letters in a Static Text box in GUIDE in MATLAB 7.1 (R14SP3)?

5 ビュー (過去 30 日間)
I would like to write Greek letters (or other LaTex symbols) like "alpha" in a Static Text Box in GUIDE.

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 5 月 14 日
UICONTROLs do not support TeX or LaTeX symbols.
To work around this limitation, one can use a TEXT object which does support LaTeX. Note that the TEXT object is not accessible in GUIDE though. Therefore you can use the following piece of code in your figure's OpeningFcn to automatically replace certain Static Text UICONTROLs with TEXT objects:
% TEXT annotations need an axes as parent so create an invisible axes which
% is as big as the figure
handles.laxis = axes('parent',hObject,'units','normalized','position',[0 0 1 1],'visible','off');
% Find all static text UICONTROLS whose 'Tag' starts with latex_
lbls = findobj(hObject,'-regexp','tag','latex_*');
for i=1:length(lbls)
l = lbls(i);
% Get current text, position and tag
set(l,'units','normalized');
s = get(l,'string');
p = get(l,'position');
t = get(l,'tag');
% Remove the UICONTROL
delete(l);
% Replace it with a TEXT object
handles.(t) = text(p(1),p(2),s,'interpreter','latex');
end
Place this piece of code right before the following line in the OpeningFcn:
% Update handles structure
guidata(hObject, handles);
Further in GUIDE give the Static Text boxes which need to be rendered using LaTeX, a 'Tag' which starts with latex_.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

製品


リリース

R14SP1

Community Treasure Hunt

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

Start Hunting!

Translated by