2011-11-14 34 views
2

我加在Matlab的图形数据光标,这个它,当我点击所示的代码“编辑文字更新功能......”如何在Matlab图中添加希腊字母到数据光标?

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 

我想在这里做的是替换字符“X” ,'Y'由希腊字符'alpha'或'beta'。我怎样才能做到这一点?

谢谢!

+1

可能的重复[如何在MATLAB中使用TeX/LaTeX格式化自定义数据提示?](http://stackoverflow.com/questions/1668071/how-do-i-use-tex-latex-formatting- for-custom-data-tips-in-matlab) – Amro

+0

我认为这个问题听起来很熟悉! gnovice有一个很好的答案:http://stackoverflow.com/questions/1668071/how-do-i-use-tex-latex-formatting-for-custom-data-tips-in-matlab/1668559#1668559 – Doresoom

回答

2

\ alpha(和一些LaTeX符号)适用于标题,也可能在这种情况下。 注意:\ Alpha是大写希腊字母,\ alpha是小写字母。

看到这个table

编辑:另请参阅Amro注释以激活(La)TeX解释器。

+0

In另外,detexify(http://detexify.kirelabs.org/classify.html)是一个很好的工具,通过在画布上绘图自动查找LaTeX符号定义。 – petrichor

+1

@ClementJ:默认情况下这不起作用,您需要将文本解释器设置为“tex''。查看链接问题 – Amro

+0

@Amro,'tex'似乎是参数的默认值。无论如何,你说得对。 –

相关问题