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

why i am taking this error? how can i fix it?

댓글 수: 3

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?

댓글을 달려면 로그인하십시오.

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 11일
편집: madhan ravi 2018년 11월 11일
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

In any context in which you bother to talk about current figure, you should not be assuming that you are using figure 1.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2018년 11월 11일

댓글:

2018년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by