NLed
NLed

Reputation: 1865

What extra Characters (non ASCII ) can be printed in Matlab?

Is there a reference list of non ASCII characters that can be printed using sprintf, fprintf, or disp ?

Characters such as :

° º ♦ ∎ ⊠ ❯ •

If I type disp('∆')

I get a blank reply, the character is not printed.

Upvotes: 1

Views: 935

Answers (1)

bla
bla

Reputation: 26069

Did you mean the output of:

 char(1:255)

Note that in Matlab's char, only the first 127 characters correspond to (non-extended) ASCII, anything after that is Unicode16. The reason Matlab does not display it correctly, is due to the fact that the Matlab command window does not treat Unicode very well by default. In any case, the output of the characters to file should not result in any difference; it is just a display issue.

However, the undocumented Matlab guru, Yair Altman (see undocumentedmatlab.com), shows how one can add HTML-aware labels to a plot. You can therefore put a Unicode characters into such a label using the &#xHEXCODE; syntax, for example:

figure;
labelStr=[ '<html> &deg; &diams; &#8718; &#8864; </html>'];
jLabel = javaObjectEDT('javax.swing.JLabel',labelStr);
[hcomponent,hcontainer] = javacomponent(jLabel,[100,100,40,20],gcf);

Upvotes: 2

Related Questions