Does Matlab 2010b intentionally omit char(8240) and others or is this a bug with a fix?
Mostrar comentarios más antiguos
Many of the char codes for symbols return a blank in Matlab 2010b. Anyone know of a fix? char(8240) (permil). Did they get renumbered? Thank you.
Respuestas (3)
Andrew Newell
el 11 de Feb. de 2011
1 voto
4 comentarios
Walter Roberson
el 11 de Feb. de 2011
Good find.
Hunting around a bit, it looks like there is a faint possibility that you might be able to use something that looks vaguely like
\DeclareUnicodeCharacter{2030}{\permil}Test{\permil}Example
except that doesn't work itself and I don't know LaTex syntax well enough to fix possible bugs in it. It might not be in the "basic LaTex support" provided by the latex interpreter Matlab uses.
Andrew Newell
el 11 de Feb. de 2011
Thanks. It was starting to sound like a bug, so I searched the database. As far as the latex goes, I tried two versions of the code for this symbol, \permil and \textperthousand, with the latex interpreter, e.g.,:
text(0,0,'\permil','Interpreter','latex')
and neither was recognized. Both are parts of special latex packages.
Walter Roberson
el 11 de Feb. de 2011
I've been doing some checking around and it looks like the above is probably not going to work.
Hunting around, it appears that LaTex was not designed for Unicode, and that non-trivial add-on packages have to be used. I looked briefly at using add-on packages a few months ago, but it _looked_ to me as if the Matlab latex interpreter was not able to import packages.
Andrew Newell
el 11 de Feb. de 2011
Of course, if the problem is displaying Unicode, a latex implementation might not work anyway.
Walter Roberson
el 11 de Feb. de 2011
0 votos
So if you type
char(8240)
at the prompt, you get a blank?
I'd be almost certain they didn't get renumbered, as the scheme used is UTF-16 encoding of Unicode, and that hasn't changed.
I would check for possible font issues on your side.
Andrew Newell
el 11 de Feb. de 2011
On my computer,
char(8240)
displays a blank, but the permil sign is visible in the workspace display for ans. So it is not a numbering issue.
I also tried displaying it on a figure using text and saving it to a file, and the permil sign does not appear. Yet in this post, the char codes for em- and en-dashes work.
2 comentarios
Santosh Kasula
el 11 de Feb. de 2011
Andy, moving your answer to comment section.
My original post above is on a Mac. A windows machine with the same version and the same font structure displays char(8240) at the prompt. I also get the same result as Andrew above with the permil symbol showing up in the workspace. I have tried changing fonts with no joy.
Walter Roberson
el 11 de Feb. de 2011
8240 needs three bytes to encode in UTF-8. Experimentally, it appears that Matlab is doing a unicode2native() operation on the string and passing those bytes, and that most of the fonts are decoding the characters separately.
I have not been able to find a way around this as yet.
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!