Importing objects when the class was placed in a package

1 view (last 30 days)
Dear All,
Is it possible to load an object of which the class definition file was placed in separate package?
For example:
T = myTestClass;
save('T');
Now I want to place my class in a package, so I create the directory structure as follows:
+myTestPack/@myTestClass/myTestClass.m
Next I try to recover the saved object:
import myTestPack.*
load('T.mat');
The outcome is always:
Warning: Variable 'T' originally saved as a myTestClass cannot be instantiated as an object and will be read in as a uint32.
Is there any way to solve this problem? I would like to restructure my code but a lot of old data was saved as objects. Maybe I need to add loadobj/saveobj methods to the definition file or maybe there is a way to rename the class from myTestClass to myTestPack.myTestClass?
Thank you for your suggestions!

Answers (0)

Categories

Find more on Software Development Tools in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!