A variable saved in a structure as a mat file in 2018b seems unreadable in 2020b

2 vues (au cours des 30 derniers jours)
Hi,
I am trying to switch to 2020b due to the cloud feature in this new version. A variable was saved in a structure, saved as the mat file named configV2.mat in 2018b. I was able to access or read the values of the variables named config.defects{1,1} as the following:
>> config.defects{1,1}
ans =
1×89 Defect array with properties:
xPositionStart
xPositionEnd
channelStart
channelEnd
isReported
defectReport
defectContour
However, when I was trying to load the SAME configV2.mat file in 2020b in the command line, it says empty value.
>> config.defects{1,1}
ans =
[]
Has anyone encountered this so far? Hope can get some suggestions on why this is happening here. Looks like I won't be able to upgrade to 2020b unless the structure needs to be resaved in a compatible format in 2018b, which is not an option for me at this moment. Looking forward to any clues on this issue. Appreciated! Joann

Réponse acceptée

Steven Lord
Steven Lord le 26 Oct 2020
If the definition of the Defect class is not available when you try to load it from the mat-file how would MATLAB know how to construct such an object? It's like you're asking MATLAB to read a book written in Klingon but it doesn't know that language.
I suspect that when you tried to load the file in the newer release you received a warning message, didn't you? If you did, what did that warning message say?
  5 commentaires
Steven Lord
Steven Lord le 27 Oct 2020
So you want users to be able to load data variables of the Defects class without being able to see or modify the Defects class? See this documentation page.
Zhao Ren
Zhao Ren le 29 Oct 2020
Yes, and thank you very much. This documentation is very helpful!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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