필터 지우기
필터 지우기

available object(created from class) identification

조회 수: 3 (최근 30일)
sunghyun chung
sunghyun chung 2019년 11월 22일
답변: Walter Roberson 2019년 11월 22일
hello
I could get the info regarding object search from below
and now I would like to get return value regarding " there is no created object"
when there is no object, how can it be detected?
I tried below,
Hmatch = findobj(OBJ);
and error message was " 'OBJ' is not defined function or variable" -- obiously
thank you

답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 22일
There are two ways that you can apply findobj()
  1. If the first input to findobj() is not an object (or array of objects), then findobj() is for looking for graphics objects with visible handles that exist anywhere in the graphics system
  2. If the first input to findobj() is an object (or array of objects) then findobj() looks "inside" only that object (or array of objects) for public members with the given properties. The object or array of objects does not need to be graphics objects in this case.
If you are asking, for example, whether any figures exist, then you can use the first form:
isempty(findobj('type', 'figure'))
If you have an array of object handles and want to know whether any members of the array have given properties, then findobj() passing in the array of handles as the first parameter; if no objects with the specific properties are found then isempty() can detect that.
findobj() for graphics objects cannot find objects for which the "handlevisibility" is set to 'off', or to 'callback' (unless findobj() is being called from inside a callback.) If you need to find graphics objects whose handle visibility is set to 'off', then use findall().
If you are trying to find out whether somewhere there is an non-graphics object of a particular class, and you do not have a starting object (or array of objects) to look inside, then there is no MATLAB support for that. If you need to keep track of all of the existing objects of a given type (and it is not a graphics object) then you will need to keep a record of each object created inside the class constructor for the object.

카테고리

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