开发者

Is it possible to display unicode in MATLAB plot labels?

I would like to call something like

xlabel( 'Time (μs)' );  

But that just shows up with a question mark on the plot. Is there anyway to 开发者_运维技巧have the unicode show up?


For your specific example, you can get the display you want using TeX\LaTeX formatting:

xlabel('Time ({\mu}s)');

For the more general case of displaying Unicode characters, if you know the code for your character you can convert the decimal value for the code to a character using the function char and build a string like so:

xlabel(['Time (' char(181) 's)']);  % Same results as above


Try this instead:

 xlabel( 'Time (\mu s)',  'interpreter','tex' );

or simply

xlabel( 'Time (\mu s)');


I'd prefer TeX\LaTeX formatting.

In general MATLAB does not have a consistent system for displaying Unicode characters. In his answer gnovice mentions using the char function but beware that this will actually display whatever character corresponds to that decimal value on your current system (based on your Locale).

On Windows that means you'll probably actually want to reference the Windows-1252 code page when choosing your decimal value. You can use this resource if you decide to use LaTeX.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜