在Matlab中打印非ASCII/符号字符 [英] print non-ASCII / symbolic characters in Matlab

查看:199
本文介绍了在Matlab中打印非ASCII/符号字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发表一份声明:

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

但产生了My angle is 1.000 pi,而不是 actual π字符.

but that produced My angle is 1.000 pi, instead of the actual π character.

我正在考虑某种方式使用Unicode ...

我发现了一些相关的东西:

I'm thinking some sort of use of Unicode...

I found some related things:

  • Page on Unicode pi
  • Sort of related SO question
  • Perhaps a more relevant SO question

推荐答案

我不知道如何使用fprintf进行操作,但是

I don't know how to do it with fprintf, but sprintf works – just leave off the semicolon:

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

或者您可以使用 disp :

Or you can use disp:

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

这篇关于在Matlab中打印非ASCII/符号字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆