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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With