Why does input() display this string improperly?
2 次查看(过去 30 天)
显示 更早的评论
I'm curious about displaying unusual characters via the char() command and how these strings behave when passed to input().
For example, this string displays the Greek character Omega at the command line, but the same string passed through input() does not. Is this a limitation of input() or some bug resulting from locale settings?
>> str = ['Value ' char(937) ' ? ']
str =
Value Ω ?
>> input(str)
Value ?
Currently running R2015b.
0 个评论
采纳的回答
Marc Jakobi
2016-10-5
It must be a bug. It seems to be fixed in Matlab R2016b.
1 个评论
Marc Jakobi
2016-10-11
编辑:Marc Jakobi
2016-10-11
Actually, it may have something to do with the fonts you have installed or the regional settings, as explained here.
更多回答(1 个)
Matthew Eicholtz
2016-10-5
I could not reproduce your error, but I am using R2016a, so maybe that is the reason.
As an alternative, try:
str = sprintf('Value %s ?',char(937));
input(str);
Does that produce the desired result?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!