Load a saved object which class definition file has been moved
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Class File Organization in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
