Print non-ASCII / symbolic characters in matlab

I would like to have a statement that did:

my_angle = 1*pi;
fprintf('My angle is %.3f pi.\n',my_angle/pi);

but it created My angle is 1.000 piinstead of the actual symbol π.

I am thinking of some use of Unicode ...

I found some related things:

+4
source share
2 answers

I don't know how to do this with fprintf, but it sprintfworks - just leave a semicolon:

sprintf('My angle is %.3f %c.\n',my_angle,char(960))

Or you can use disp:

disp(['My angle is ' num2str(my_angle,'%.3f') ' ' char(960) '.']);
+4
source

. Windows Matlab Windows-1252, . , char 255 /. Linux UTF8 char , .

-1

All Articles