Azzera filtri
Azzera filtri

available object(created from class) identification

3 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Walter Roberson
Walter Roberson il 22 Nov 2019
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.

Categorie

Scopri di più su Graphics Object Identification in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by