MATLAB Answers

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

10 views (last 30 days)
Zhao Ren
Zhao Ren on 26 Oct 2020
Commented: Zhao Ren on 29 Oct 2020 at 14:40
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:
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


Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 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?


Show 2 older comments
Zhao Ren
Zhao Ren on 27 Oct 2020
It's loading perfectly with the path included. Thank you so much for guiding to find the cure! Please bear with me with another question. The configV2.mat is saved from standalone program compiled under R2018b. If the user of the program wants to develop some work using this configV2 in Matlab, but not allowed to have the source code of the program, what is the way for the user to access the values of this data saved in this configV2? Bear with me, I am not coming from a computer background which could be easier to find a clue. Is there something need to be created and give to the user so that he/she can call a program to allow definition of the mat file. Appreciated if you can shed some light to this!! Joann
Steven Lord
Steven Lord on 27 Oct 2020 at 20:06
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by