When implementing a load object method with:
I would like to be able to get the path of the orinial file which caused this object to load.
function obj = loadobj(s)
FilePath = SolutionCode();
disp("The obj was loaded from " + FilePath );
obj = s;
When loading a saved file containing an instance of MockObj, I would like to print the location of this file, from within the method.
I'm missing the
which will give me the fullpath of the file which caused MockObj to load.
The file is the .mat file which MATLAB creates when you save your workspace.
Once it is saved, you can move your file to whatever folder.
When you load a file that contains an instance of MockObj class, the loadobj(s) method is being called.
Unfortunately, once you’re inside the method, it seems as if you’ve lost any information about the .mat file. You can only access the variable s, which is the object itself.
That’s what I’m looking for.. A way to figure out something about the .mat file which caused the method loadobj(s) of my MockObj class.
Any other solution is also blessed.
Thanks in advance,