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

1 次查看(过去 30 天)
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

采纳的回答

Sean de Wolski
Sean de Wolski 2018-1-4
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 个评论
Walter Roberson
Walter Roberson 2018-1-4
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by