Can't change xlabel font because of diacritics (č, ř, š, ...)
8 views (last 30 days)
My language uses letters that use diacritics (č, ř, ž, ... ).
I tried to change font in my Matlab script to Latin Modern Roman, and it gave a following error:
Warning: Error updating Text.
String scalar or character vector must have valid interpreter syntax: čas (s)
> In defaulterrorcallback (line 12)
> In print (line 36)
The font was not applied. After I removed the č letter, everything went fine.
The command I used was:
xlabel('čas (s)','Fontsize',fsz,'FontName','Latin Modern Roman')
Perhaps there is a different way.
Dave B on 31 Dec 2022
The error you're seeing is because of the tex interpreter, although I don't reproduce it with the same characters. If you're not relying on the tex interpreter, you could try turning it off.
Note that in the example below I chose a font that I knew would be recognized in the browser, to check if the font is defined in your desktop version of MATLAB use the listfonts function.