Error using latex in function

1 visualizzazione (ultimi 30 giorni)
Eitan Schechtman
Eitan Schechtman il 21 Mar 2016
Risposto: Walter Roberson il 21 Mar 2016
Hello, I'm trying to use latex to insert a specific symbol using the "text" command in Matlab 2014b. The line in my function is pretty straightforward:
text(1.5,0.43,'\fontname{Lucida sans unicode}\fontsize{12}?')
(the symbol appears as a box in the Matlab editor window)
When using this line in a function, a question mark is displayed instead of the symbol. However, when using the same line from the command window the symbol appears with no problems. Finally, I tried inserting a breakpoint at this line in the function and then inserting it to the command line - and it also works fine.
Any ideas regarding how I can display the symbol without resorting to breakpoints as a way of life?
Thanks, Eitan

Risposta accettata

Walter Roberson
Walter Roberson il 21 Mar 2016
Is the symbol one whose Unicode position is 256 or greater? If so then you might not be able to hard-code without taking special steps to convert your MATLAB to use UTF8 .m files. Try building up a string with char() of the numeric position, such as
text(1.5, 0.43, ['\fontname{Lucida sans unicode}\fontsize{12}', char(1234)])

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by