Convert char to number behaves different in command window and m script file

1 Ansicht (letzte 30 Tage)
A =[ 266 316 316 365 366 375 377 362 365 341 345 354 360 345 353 340 350 354 366 405 420 420 478 479 450 440 416 405 385 430 415 393 382 353 345 348 343 314 310 350 348 337 336 330 297];
bString = char(A)
bStringCopy = 'ĊļļŭŮŷŹŪŭŕřŢŨřšŔŞŢŮƕƤƤǞǟǂƸƠƕƁƮƟƉžšřŜŗĺĶŞŜőŐŊĩ'
disp(isequal(bString,bStringCopy))
disp(isequal(double(bString),double(bStringCopy)))
If I copy to command window,the result is :
bString =
ĊļļŭŮŷŹŪŭŕřŢŨřšŔŞŢŮƕƤƤǞǟǂƸƠƕƁƮƟƉžšřŜŗĺĶŞŜőŐŊĩ
bStringCopy =
ĊļļŭŮŷŹŪŭŕřŢŨřšŔŞŢŮƕƤƤǞǟǂƸƠƕƁƮƟƉžšřŜŗĺĶŞŜőŐŊĩ
1
1
However, if I save the code into script and run, then result is different.The script looks exactly the same, but result is different. It's really weired.
codebString =
ĊļļŭŮŷŹŪŭŕřŢŨřšŔŞŢŮƕƤƤǞǟǂƸƠƕƁƮƟƉžšřŜŗĺĶŞŜőŐŊĩ
bStringCopy =
?????????????????????????????????????????????
0
0
  1 Kommentar
raym
raym am 4 Jan. 2018
For normal char on keyboard, this is not a problem, but for peculiar char, the problem appeared.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 4 Jan. 2018
This also works in the live editor which supports more unicode. The classic editor does not support it and thus truncates the values apparently.
  1 Kommentar
Walter Roberson
Walter Roberson am 4 Jan. 2018
The classic editor supports it if UTF-8 files are enabled. Those are automatically in effect for people using the Japanese, Korean, or Chinese interfaces, but can be tricky to enable otherwise.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by