Error when loading structure in MATLAB 7.5.0

1 次查看(过去 30 天)
I have a structure into which I have saved substructures containing string and array data types. Typically, when saving with new data I select the structure from the workspace, click Save As: [same file name] and overwrite the previous version. This has worked fine until now. When I try to load my most recently saved version, I encounter the message:
Warning: Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2007b\toolbox\matlab\graphics\@graphics\@ploteditbehavior\schema.m>doEnableAction
Warning: An invalid object is being loaded
??? Error using ==> load root class can not be instantiated.
The file size is only 3.7MB. Is there anything I can do to recover this data?
Edit: the file in question is attached in case anyone feels inclined to give it a shot. I realized that I inadvertently saved much more to the variable, including two data acquisition objects. However, despite including those objects I have been since unable to replicate the error, all dummy structures I create load properly.
  2 个评论
James Tursa
James Tursa 2015-5-26
Looks like MATLAB cannot find the function associated with the saved function handle. Check to see that the directories and function m-file still exists.
Ryan Caldwell
Ryan Caldwell 2015-5-26
Thanks for replying. I saved the variable, cleared the workspace and immediately attempted to load it again, which is when I saw the error, so no changes had been made to the directories. I don't know where the saved function handle would come into play, as the structure only (to my knowledge) contained scalars, numeric arrays and date fields.

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2015-5-26
You saved a graphics object and now it is having difficulty restoring it. The graphics object appears to have to do with the Plot Editor.
Are you possibly trying to restore to an earlier version of MATLAB than you saved the file in? Right around that release there was a change in some of the graphics objects that made some of them not loadable in previous versions.
I think you may be able to restore anything that does not have a graphics object in it, by specifying the variable name at the time you load. For example,
load('MyFile.mat', 'Xattenuated')
to load the "Xattenuated" variable. You can use
whos -file MyFile.mat
to get the names of the saved variables.
  1 个评论
Ryan Caldwell
Ryan Caldwell 2015-5-26
Thanks for the response. Everything was performed in MATLAB 7.5.0. Unfortunately, attempting what you suggest does not generate anything different.

请先登录,再进行评论。


Dave
Dave 2015-6-10
As others have brought up, the problem is that MATLAB HG object handles went from being doubles to actual handles.
What I did is, before I save, I strip the handle objects from my structure, but save the attributes of the objects I want to restore upon reload (say, for an IMROI, position, color, etc.). When I load it back up, it restores them automatically. It's a bit of extra work, but not too hard.

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by