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!