How to add Greek letter to data cursor in Matlab figure?

巧了我就是萌 提交于 2019-12-24 04:42:05

问题


I added a data cursor in a Matlab figure, and this it the code shown when I clicked "Edit Text Update Function..."

function output_txt = myfunction(obj,event_obj)
% Display the position of the data cursor
% obj          Currently not used (empty)
% event_obj    Handle to event object
% output_txt   Data cursor text string (string or cell array of strings).

pos = get(event_obj,'Position');
output_txt = {['X: ',num2str(pos(1),4)],...
    ['Y: ',num2str(pos(2),4)]};
% If there is a Z-coordinate in the position, display it as well
if length(pos) > 2
    output_txt{end+1} = ['Z: ',num2str(pos(3),4)];
end

What I want to do here is replacing the characters 'X', 'Y' by the Greek character like 'alpha' or 'beta'. How can I do that?

Thank you!


回答1:


\alpha (and some LaTeX symbols) works in title and probably in this case too. Note: \Alpha is the capital greek letter, \alpha is the small one.

See this table.

EDIT : See also Amro comments to activate the (La)TeX interpreter.



来源:https://stackoverflow.com/questions/8118966/how-to-add-greek-letter-to-data-cursor-in-matlab-figure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!