Borrar filtros
Borrar filtros

Greek symbols in MATLAB GUI

18 visualizaciones (últimos 30 días)
Maciej Wroz
Maciej Wroz el 30 de Oct. de 2015
Respondida: Walter Roberson el 30 de Oct. de 2015
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

Respuesta aceptada

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

Más respuestas (2)

Adam
Adam el 30 de Oct. de 2015
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 el 30 de Oct. de 2015
Editada: Joep el 30 de Oct. de 2015
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 comentarios
Joep
Joep el 30 de Oct. de 2015
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 el 30 de Oct. de 2015
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);

Iniciar sesión para comentar.

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by