??? Reference to non-existent field 'matlab'.
古いコメントを表示
Dear Matlab users,
In Matlab 2009b, when I save a file that is open in the editor, the save executes successfully while the console returns the error:
??? Reference to non-existent field 'matlab'.
This occurs with no execution of code and does not crash any code that is executing, but returns the error once control is returned to the console. Restarting my system or matlab does not clear the issue.
It is more of a nuisance than anything else, but it would be nice to get to the bottom of it. Any ideas?
Cheers, Jordan
回答 (7 件)
Jan
2012 年 3 月 27 日
Is this the complete error message? Does:
E = lasterror
reveal the location, which function throws the error?
Does the error appear, if you exclude all user-defined functions from the PATH? If not, one of your functions shadows a function, which is called during saving. It is hard to avoid such problems, because there is no built-in tool to detect such collisions. I've tried to develop such a tool, but the interest in the community is negligible.
Matt Tearle
2012 年 3 月 27 日
1 投票
A shot in the dark, but... your filename isn't something like myfile.matlab.m is it...?
6 件のコメント
Jordan
2012 年 3 月 27 日
Image Analyst
2012 年 3 月 27 日
Well how long is this file? Is it too long to simply paste here so people can stop guessing and see your code?
Jordan
2012 年 3 月 28 日
Matt Tearle
2012 年 3 月 28 日
And nothing funky in your path names either, right? (Sorry, don't mean to be a dork, but you mentioned something about it happening after you added directories to your path.)
Daniel Shub
2012 年 3 月 28 日
@Matt, I think the potential for a funky path, or some other corrupted setting, is a likely culprit.
Malcolm Lidierth
2012 年 3 月 30 日
The only accessible reference to MATLAB:nonExistentField seems to be in Tiff.m where the exception is thrown from the MATLAB tifflib code - but that does not help much.
Sean de Wolski
2012 年 3 月 27 日
dbstop if error
Then generate the error and see where it's being called.
4 件のコメント
Jordan
2012 年 3 月 27 日
Sean de Wolski
2012 年 3 月 27 日
What is your complete workflow? You have a file open in the editor, you save it, you see the error? Is that all? Do you have something shadowing save?
Jordan
2012 年 3 月 27 日
Matt Tearle
2012 年 3 月 28 日
How are you saving? Clicking the Editor save icon, ctrl-S, issuing the save command in Command Window, etc? And out of curiosity, what happens if you issue the following commands instead:
foo = matlab.desktop.editor.getActive
foo.save
Daniel Shub
2012 年 3 月 28 日
0 投票
Have you tried deleting/renaming your preferences directory?
Jan
2012 年 3 月 28 日
0 投票
I guess you have shadowed a Java function, which is required for saving. If the hypothetical function "tool.matlab.editor.save" would be used and you have a variable called "tool", the error message should be similar to your oberservations.
Unfortunately I do not know a function, which contains ".matlab". My trial to ask Google failed, because the dots have been converted automagically to spaces even if I include the term ".matlab." in double quotes and Google CodeSearch is down.
Does whos reveal and suspicious candidates?
3 件のコメント
Sean de Wolski
2012 年 3 月 28 日
autononmagic!
Daniel Shub
2012 年 3 月 28 日
I am not sure you can overload java functions this way. I created a dummy function java.m and added it to my path and made its directory the current working directory. The call f = java.io.File('MyFile') does not seem to use the overloaded function.
Jan
2012 年 3 月 29 日
I'm not sure also. It is statistical guessing, because unintentionally overloaded functions have been a source of weird problems repeatedly.
Andrew Meintz
2021 年 2 月 10 日
0 投票
I had the same issue and when I clean the build folder from previous generated file. It works.
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!