gca behaves different in 2014b

조회 수: 2 (최근 30일)
Christian Schultes
Christian Schultes 2014년 10월 12일
댓글: Christian Schultes 2014년 10월 12일
Hello, Let assume there is already a figure open (like a GUI). Before 2014b with gca the handle number returned. Now with gca a new figure will open.
How could I get the current handle of a figure back?
In my special case, I try to get access to a certain axes of an existing figure. Any help avialable?
Thanks!
  댓글 수: 3
Christian Schultes
Christian Schultes 2014년 10월 12일
It works so fine in prior releases, but in 2014b the results as shown:
>> isempty(get(groot,'CurrentFigure'))
ans =
1
>>
Christian Schultes
Christian Schultes 2014년 10월 12일
I've got the answer. The settings of the GUI must be HandleVisibility = ON !!!

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

채택된 답변

Christian Schultes
Christian Schultes 2014년 10월 12일
Always t
urn the HandleVisibility ON then the commands gca and gcf will work.

추가 답변 (1개)

David Barry
David Barry 2014년 10월 12일
Christian,
This seems to work fine. Are you sure you definitely have an axes in your figure? gca will only open a new figure with an axes in if you call it and one doesn't already exist.
Try the code below and see if returns 1
f = figure;
a = axes('Parent', f);
g = gca;
a == g
  댓글 수: 1
Christian Schultes
Christian Schultes 2014년 10월 12일
Hello David.
Yes I'm sure. But now I found the issue! Not sure why it did work in R2011b. See my own answer.

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

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by