Load a saved object which class definition file has been moved
3 次查看(过去 30 天)
显示 更早的评论
I have trouble reloading previously saved objects of a user class after having moved the package containing the class definition.
If i try to be more precise, here is one example:
Let say that i have a class 'myClass' defined in the file '.\+myPkg\+mySubPkg\myClass.m'. I saved one object of this class to the file 'myObject.mat' (using a custom 'saveobj' function, but I don't think that it changes something). Now, for any reasons I want to change the containing folder name '+mySubPkg' to '+mySecondPkg'. If I do this, I won't be able to reload the object in 'myObject.mat' correctly, and MATLAB will issue an error saying: "Warning: Cannot load an object of class 'myClass': Its class cannot be found."
Is there any way to be able to load the object, like from a custom loadobj function or so ? In particular, if 'myClass' inherits from the class 'mySuperClass', which containing folder has not been moved, can I use the loadobj fcn of mySuperClass to re-instanciate an object of 'myClass' from 'myObject.mat' ?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Class File Organization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!