필터 지우기
필터 지우기

Handle of a figure

조회 수: 11 (최근 30일)
Gennaro Arguzzi
Gennaro Arguzzi 2016년 3월 24일
댓글: Walter Roberson 2016년 3월 25일
Hi, I read that the command gcf is the handle of the current figure. What is an handle? If is a pointer, why it does not contain an address? Thank you for your help.

답변 (2개)

Walter Roberson
Walter Roberson 2016년 3월 24일
A "handle" gives information about where to look for something, but a "handle" is not necessarily an address. Handles are used especially in cases where something is managing memory on the user's behalf, as the actual location of the data might move in memory but the "handle" will stay the same. Object #792 stays object #792 no matter where it gets placed in memory.
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 3월 25일
In R2014a and earlier, floating point numbers were used for the handles. They often gave the impression of having some structure, but the meaning was undocumented. In any case the floating point number was used as a reference to locate the graphics object. User-created figures were typically given handles that were integral but still floating point. They were more or less "serial numbers", fixed information that would allow MATLAB to uniquely decide which object was being referred to.
R2014b and later, graphics objects get handles in the sense of object-oriented handles sense. These are not displayable (attempts to display them would give a brief brief summary of the object.) They are as close to addresses as MATLAB uses for its objects for public presentation. MATLAB does internally use addresses for some things, but when you are not in the middle of a mex routine, anything can be moved around in memory.

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


Joseph Cheng
Joseph Cheng 2016년 3월 24일
편집: Joseph Cheng 2016년 3월 24일
You should rephrase your question to what are you trying to accomplish with the handle of the current figure. getframe(gcf) does not return the handle. getframe(gcf) as described by the help documentation http://www.mathworks.com/help/matlab/ref/getframe.html (which you really should read first before posting) basically as stated by them
"F = getframe(fig) captures the figure identified by fig. Specify a figure if you want to capture the entire interior of the figure window, including the axes title, labels, and tick marks. The captured movie frame does not include the figure menu and tool bars."
to get the handles see http://www.mathworks.com/help/matlab/ref/gcf.html which is gcf. handles from my knowledge are not pointers but the item that MATLAB "handles" the item. So by obtaining the handles through gcf or defining before hand you can modify the properties that matlab usually hides from the workspace. But that's my superficial understanding of matlab handles. Someone please correct me if i'm wrong as i don't have much time to google it at the moment. (that or i've forgotten what pointers are)

카테고리

Help CenterFile Exchange에서 Graphics Object Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by