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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Sean de Wolski
Sean de Wolski il 4 Gen 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 Commento
Walter Roberson
Walter Roberson il 4 Gen 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by