필터 지우기
필터 지우기

Greek symbols in MATLAB GUI

조회 수: 17 (최근 30일)
Maciej Wroz
Maciej Wroz 2015년 10월 30일
답변: Walter Roberson 2015년 10월 30일
How can i write a formula with Greek symbols, which I want to show in GUI: Formula M_o=C(\omega_m)^2
Please help me

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 30일
Note: additional capabilities have been added for Unicode characters since the time that Question was written; in particular starting R2014b more can be done.

추가 답변 (2개)

Adam
Adam 2015년 10월 30일
hAxes = axes( 'Position', position, 'Visible', 'off' );
text( 0.1, 0.1, 'M_o=C(\omega_m)^2', 'Parent', hAxes );
will create you text on a GUI with symbols (in R2015b, I don't know if you need to set any extra settings in older versions)
The position variable will obviously contain the usual position data that you would use for positioning a standard uicontrol, but unless they have changed uicontrols do not allow symbols so this is a workaround because 'text' objects do, but they have to be created on an axes.

Joep
Joep 2015년 10월 30일
편집: Joep 2015년 10월 30일
better is to use ^{....} instead of ^. \omega not work that is because your interpreter is set wrong. It should be on TeX. You can change it in the GUI builder or by using:
set(handle,'interpreter','tex')
  댓글 수: 3
Joep
Joep 2015년 10월 30일
You did not specify anything as handle. Example:
prompt = {'\mu'};
dlg_title = 'Input';
num_lines = 1;
def = {'150'};
options.Resize='on';
options.WindowStyle='normal';
options.Interpreter='tex';
answer = inputdlg(prompt,dlg_title,num_lines,def,options);
numberOfCells = str2double(answer{1});
clearvars prompt dlg_title num_lines def answer
You need to refer to the handle. I assume u know what handles are when you working with GUI otherwise you should watch a introduction of Doug, http://blogs.mathworks.com/videos/2013/02/13/gui-building-in-matlab/. He has multiple ones.
Joep
Joep 2015년 10월 30일
Sorry my mistake. Unfortunately it seems Matlab doesn't use the same text drawing methods on graphs, which support LaTeX, as it does on GUI elements. Here is a webpage explaining a workaround: http://undocumentedmatlab.com/blog/customizing-matlab-labels/
Basically, you will need to manually determine where you want the text to be on your GUI in terms of pixel position, and length, and rewrite your equation in HTML instead of LaTeX.
In the GUIDE interface for your GUI, you will need to click the "Editor" button on the toolbar menu, and find the section:
function initialize_gui(fig_handle, handles, isreset)
You'll want to insert your labeling code before the:
% Update handles structure
guidata(handles.figure1, handles);

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

카테고리

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