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 个评论
回答(2 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!