MATLAB Answers

zin zin
0

Undefined function or variable 'currentFigure'. Error in matlab.gra​phics.inte​rnal.newpl​otwrapper (line 14) if isempty(currentFigure)

Asked by zin zin
on 11 Nov 2018
Latest activity Commented on by zin zin
on 2 Dec 2018
why i am taking this error? how can i fix it?

  3 Comments

In MATLAB CurrentFigure is a property you can get from the graphic root object but currentFigure is not the name of any Mathworks supplied routine.
If we had more context we might be able to figure out what should be used there.
p1=0;
p2=-2;
poles=[p1,p2];
num=[1];
den=poly(poles);
k=[0:0.01:10];
r=rlocus(num,den,k);
damp1= 0;
damp2=.45;
damp=[damp1,damp2];
om1=0;
om2=100;
om=[om1,om2];
grid on;
sgrid('new');
sgrid(damp, om);
grid on;
plot(r, '*');
I got the error when i tried to run this code. But i got the error in line 12.
this code worked 2 days ago...
now the plot function will not work
are you getting the same error? like CurrentFigure error?

Sign in to comment.

1 Answer

Answer by madhan ravi
on 11 Nov 2018
Edited by madhan ravi
on 11 Nov 2018
 Accepted Answer

g = groot; %edited after sir Walter's comment
isempty(g.Children) % True if there are no open graphics objects, false otherwise
%---------------------------
fig = get(groot,'CurrentFigure');
~isempty(fig)

  6 Comments

Sign in to comment.