フィルターのクリア

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 Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by