Why do I get the error "Undefined function or variable 'onCleanup'"?

14 次查看(过去 30 天)
Hi everybody. Opening programs I get this error:
Undefined function or variable 'onCleanup'.
Error in getnicedialoglocation (line 21)
c = onCleanup(@() close(convertData.hFig));
Error in msgbox (line 324)
DefFigPos = getnicedialoglocation(DefFigPos, get(figureHandle,'Units'));
Error in errordlg (line 47)
handle = msgbox(ErrorStringCell,DlgName,'error',Replace);
Error in uiopen (line 194)
errordlg(err);
What can I do to solve the problem and start using Matlab again?

回答(2 个)

ES
ES 2017-5-30
Something is wrong with your path.
onCleanUp resides here. It should be visible on startup.
{MATLAB Installation Directory}\toolbox\matlab\general\onCleanup.m
Try
which onCleanup
restoredefaultpath
commands

Jan
Jan 2017-5-30
The first point to start is asking the docs about this function. In the current version found on the MathWorks pages (and found by Google):
There it is mentioned, that the function was "Introduced in R2008a". Do you run an older version? Then it would be useful, if you mention this.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by