How can I plot the euro symbol? Which is its codification on matlab?

22 visualizaciones (últimos 30 días)
Chiara Labate
Chiara Labate el 15 de Oct. de 2017
Editada: Walter Roberson el 8 de Dic. de 2018
I should plot the euro symbol taken from an html file. How can i do?
  1 comentario
Rik
Rik el 15 de Oct. de 2017
What do you mean with plot? Make a line drawing? Show it as a text in a figure? Holding it in an array?
Have a read here and here. It will greatly improve your chances of getting an answer.

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 16 de Oct. de 2017
Editada: Walter Roberson el 8 de Dic. de 2018
With sufficiently new MATLAB and not using too old a version of MS Windows, then Jonathan Chin's suggestion of char(8364) works for display to the command window. The versions for Mac that you could count on char() working go back further. The Linux versions depended at lot on distribution.
Starting from R2014b, char() of beyond 255 started being supported directly in all forms of uicontrol and in uitable.
In R2014a and earlier, it was not possible to put such characters into uicontrol style 'text' or 'edit'. It was possible to put such characters into uicontrol style pushbutton, toggle, radio, checkbox, slider, listbox, or popup, but in order to do so you had to code the string property as starting with '<html>' (not case sensitive) and then you had to use the appropriate ampersand coding, such as &#8364; . A limited number of named HTML character entities were also available. The html trick could also be used on a per-cell basis for uitable() . The html trick continues to be supported in R2014b and later to date.
With regards to plotting:
  • in R2011a or earlier (release is approximate), it was not possible to plot such characters as text on the display, or in titles or ticks, in any field with no interpreter or whose interpreter was set to 'none'. Characters in the range char(128) to char(255) mostly just did not show up at all; characters beyond char(255) would be treated as two independent bytes with whatever result that gave.
  • in R2011a or earlier (release is approximate), using char() beyond 255 in a text field set to interpreter tex or latex would result in an interpreter syntax error and none of the text would be displayed
  • in R2011a or earlier (release is approximate), a limited number of named characters entities could be displayed as text on the display, in fields with interpreter tex or latex. Some of them are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question . The Euro sign was not available.
  • in R2011a or earlier (release is approximate), the only way to plot such characters in ticks or titles, was to give a tick or title, and then go into the axes properties and extract the text object that underlay the tick or title, and set the interpreter of that object to tex or latex, and use one of the limited number of named character entities. Some of those entities are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question. The Euro sign was not available. Trying to use char() of beyond 255 would result in the previously-mentioned text interpreter syntax error
  • In R2011b (approximately) to R2014a, it was not possible to plot such characters as text on the display, or in titles or ticks, for any field which did not offer an 'intepreter' field, or whose 'interpreter' was set to 'none'.
  • in R2011b (approximately) to R2014a, a limited number of named characters entities could be displayed as text on the display, in fields with interpreter tex or latex. Some of them are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question . The Euro sign was not available.
  • in R2011b (approximately) to R2014a, the only way to plot general characters as text on the display, was to find the obscure latex configuration file for MATLAB and tell it to include one of the unicode or mathematics packages, and set the text() object to interpreter 'latex' and use the appropriate latex code
  • in R2011b (approximately) to R2014a, a limited number of named characters entities could be displayed as text on the display, in fields with interpreter tex or latex. Some of them are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question . The Euro sign was not available.
  • in R2011b (approximately) to R2014a, the only way to plot general characters in ticks or titles, was to find the obscure latex configuration file for MATLAB and tell it to include one of the unicode or mathematics packages, and then go into the axes properties and extract the text object that underlay the tick or title, and set that text object to interpreter latex, and then set the text object String property to have the appropriate coding.
  • In R2014b and later, you can use char() to include such characters for any text field or tick or title which has no interpreter, or whose interpreter is set to 'none'. The Euro character is supported.
  • In R2014b and later, you can use char() to include such characters for any text field or tick or title whose interpreter set to is 'tex'. The Euro character is supported.
  • In R2014b or later, any attempt to use char() to include characters beyond 255 in an text field set to interpreter latex will result in an interpreter syntax error and none of the text will be displayed
  • In R2014b to approximately R2016a, a limited number of named characters entities could be displayed as text on the display, in fields with interpreter tex or latex. Some of them are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question . The Euro sign was not available.
  • In R2014b to approximately R2016a, the only way to plot general characters as text on the display or tick or title whose interpreter field had been set to 'latex', was to find the obscure latex configuration file for MATLAB and tell it to include one of the unicode or mathematics packages, and to set the text object String property to the appropriate coding
  • In approximately R2016b and later (exact release not currently known), a limited number of named characters entities could be displayed as text on the display, in fields with interpreter tex or latex. Some of them are described at https://www.mathworks.com/matlabcentral/answers/14751-greek-alphabet-and-latex-commands-not-a-question . The Euro sign was not available.
  • In R2016b or so and later (exact release not currently known), you can cannot use char() to include such characters for any text field whose interpreter is set to 'latex', and there is no known work-around; the previous latex configuration file is no longer used and the replacement configuration file is all binary with no currently known interpretation.
The above table could be made a bit more compact:
  • In latex fields, possible only as named entities before roughly R2011a, or R2016b onwards, and Euro was not supported
  • From roughly R2011b to roughly R2016a, a configuration file could be hacked to allow use of mathematics or unicode latext packages that supported a greater variety of characters
  • In fields with no intepreter or interpreter none or interpreter tex, not possible up to R2014a, but char() works for those kinds from R2014b onward
  • Up to R2014a, to use the named entities in tick marks or titles you had to find the underlying text object and changes its properties.

Jonathan Chin
Jonathan Chin el 15 de Oct. de 2017
Take a look at the char function, you can look up the codes for other symbols here https://www.ascii.cl/htmlcodes.htm You can use the HTML codes, ex for the euro symbol €
char(8364)
ans =

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by