close all "non-existent field 'view'" error

1 次查看(过去 30 天)
I am working on a code which yield error at command
close all
The error is
>> close all
Error using close
Reference to non-existent field 'views'.
_Error in close
Caused by:
Error while evaluating figure CloseRequestFcn_
Acutally, I found it was commonly used.
But it simply doesn't work on my computer. I google it, no post talking about it. Is there anything with my matlab?
My matlab version is 2017a.
  3 个评论
Shuangjun
Shuangjun 2018-5-7
The result from running which -all close It seems all from build-in and toolbox.
e:\Program Files\MATLAB\R2017a\toolbox\matlab\graphics\close.p e:\Program Files\MATLAB\R2017a\toolbox\shared\asynciolib\+asyncio\Channel.m % asyncio.Channel method close is a built-in method % asyncioimpl.Channel method e:\Program Files\MATLAB\R2017a\toolbox\matlab\codetools\+matlab\+desktop\+editor\@Document\Document.m % matlab.desktop.editor.Document method close is a Java method % com.mathworks.mde.editor.MatlabEditorApplication method close is a Java method % com.mathworks.matlab.api.editor.EditorApplication method close is a Java method % com.mathworks.mde.editor.MatlabEditor method close is a Java method % com.mathworks.matlab.api.editor.Editor method e:\Program Files\MATLAB\R2017a\toolbox\shared\reqmgt\+rmiml\@RmiMlData\RmiMlData.p % rmiml.RmiMlData method e:\Program Files\MATLAB\R2017a\toolbox\shared\reqmgt\+rmidata\@RmiData\RmiData.p % rmidata.RmiData method close is a Java method % com.mathworks.mde.desk.MLDesktop method close is a Java method % com.mathworks.widgets.desk.Desktop method e:\Program Files\MATLAB\R2017a\toolbox\matlab\iofun\@ftp\close.m % ftp method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@yahoo\close.m % yahoo method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@tlkrs\close.m % tlkrs method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@reuters\close.m % reuters method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@rdth\close.m % rdth method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@moneynet\close.m % moneynet method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@kx\close.m % kx method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@haver\close.m % haver method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@fred\close.m % fred method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@factset\close.m % factset method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@datastream\close.m % datastream method e:\Program Files\MATLAB\R2017a\toolbox\datafeed\datafeed\@blp\close.m % blp method e:\Program Files\MATLAB\R2017a\toolbox\instrument\instrument\@icdevice\close.m % icdevice method e:\Program Files\MATLAB\R2017a\toolbox\shared\instrument\@instrument\close.m % instrument method e:\Program Files\MATLAB\R2017a\toolbox\mbc\mbctools\@mdevproject\close.m % mdevproject method e:\Program Files\MATLAB\R2017a\toolbox\mbc\mbcview\@cgproject\close.m % cgproject method e:\Program Files\MATLAB\R2017a\toolbox\matlab\serial\@serial\close.m % serial method e:\Program Files\MATLAB\R2017a\toolbox\sl3d\sl3d\@vrworld\close.m % vrworld method e:\Program Files\MATLAB\R2017a\toolbox\sl3d\sl3d\@vrspacemouse\close.m % vrspacemouse method e:\Program Files\MATLAB\R2017a\toolbox\sl3d\sl3d\@vrjoystick\close.m % vrjoystick method e:\Program Files\MATLAB\R2017a\toolbox\sl3d\sl3d\@vrfigure\close.m % vrfigure method e:\Program Files\MATLAB\R2017a\toolbox\simulink\simulink\upgradeadvisor\@UpgradeAdvisor\close.p % UpgradeAdvisor method e:\Program Files\MATLAB\R2017a\toolbox\symbolic\symbolic\@mupad\close.m

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2018-5-7
编辑:Jan 2018-5-7
It seems like one of the figures has a failing CloseRequestFcn. Try to identify it by using the debugger. Type this in the command window:
dbstop if error
and run the code again. Does this offer any further information about which window causes the troubles? If not:
FigList = findall(groot, 'Type', 'figure');
for k = 1:numel(FigList)
Fig = FigList(k);
disp([Fig.Name, ' ', Fig.Title]);
close(Fig)
end
Is there any user-defined code in the CloseRequestFcnof the failing figure? If so:
function bruteCloseAll
FigList = findall(groot, 'Type', 'figure');
for k = 1:numel(FigList)
Fig = FigList(k);
try
close(Fig);
catch ME
fprintf('Forced closing after error: %s\nFigure: %s\n', ...
ME.message, [Fig.Name, ' ', Fig.Title]);
set(Fig, 'CloseRequestFcn', '', 'DeleteFcn', '');
close(Fig)
end
end
end

Shuangjun
Shuangjun 2018-5-7
It works now, though I don't know the particular reason. It seems yesterday, matlab didn't work properly. Or perhpas I ran a code which which failed to work though that possibly caused the trouble.
Everything is fine today when I ran close all. No error at all.
Thank you for your reply

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by