问题
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