Why does input() display this string improperly?

1 Ansicht (letzte 30 Tage)
Nicholas
Nicholas am 5 Okt. 2016
Bearbeitet: Marc Jakobi am 11 Okt. 2016
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.

Akzeptierte Antwort

Marc Jakobi
Marc Jakobi am 5 Okt. 2016
It must be a bug. It seems to be fixed in Matlab R2016b.
  1 Kommentar
Marc Jakobi
Marc Jakobi am 11 Okt. 2016
Bearbeitet: Marc Jakobi am 11 Okt. 2016
Actually, it may have something to do with the fonts you have installed or the regional settings, as explained here.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Matthew Eicholtz
Matthew Eicholtz am 5 Okt. 2016
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?
  1 Kommentar
Nicholas
Nicholas am 5 Okt. 2016
Same error, unfortunately. Sounds like an R2015b bug. Thanks for the attempt!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by