Error when loading structure in MATLAB 7.5.0

조회 수: 2 (최근 30일)
Ryan Caldwell
Ryan Caldwell 2015년 5월 26일
댓글: Walter Roberson 2015년 6월 10일
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.
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 6월 10일
In R2007b that the poster has, graphics handles were still doubles.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by