Unreadable UTF characters when they are loaded in MATLAB R2022b, but they could be readable in R2020b

47 vues (au cours des 30 derniers jours)
The table data are Chinese characters and saved in MAT-file by using MATLAB R2020b as attachment. In R2022b, MATLAB can load the table variable (db_Indicators), but the non-ASCII part of data in the table are unreadable.
Unzipped the attachment, and then running In MATLAB R2022b as following
load('database.mat','db_Indicators')
double(db_Indicators.UniNum{1})
It produces as
ans =
65533 49 46 49
In MATLAB R2020b, however,
It could be correctly displayed as
ans =
8470 49 46 49
Please help to correct the problem. Greatly thanks!

Réponse acceptée

Bruno Luong
Bruno Luong le 12 Nov 2024 à 5:32
Modifié(e) : Bruno Luong le 12 Nov 2024 à 6:34
It sounds like it related to the bug fix they carried out in 2021b, see @Stefanie Schwarz answer here; This breaks the encioding/decofing compatibility before and after this release.
  1 commentaire
国强 关
国强 关 le 12 Nov 2024 à 9:48
Thanks. The clues here hint of the goodness in coding behaviour. I previously drag the variable (db_Indicators) in the workspace window and drop it into the MAT-file. It seems the bad habit to make the data unreadable and being lost by loading in the updated MATLAB R2022b. If using the save command as
save('database.mat','db_Indicators','-append')
the MAT-file would be free of the messy data in later MATLAB.
Maybe, MATHWORK should give some warning of data vulnerability when users save the non-ASCII data in MAT-file by dragging & dropping.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by