MATLAB Object-Oriented Programming

(Joyce) #1

NW = findobj(PB,'Name','Nancy Wong');
[NW.Name,' - ',NW.Number]


ans =


Nancy Wong - 5081234569


Find Objects with Specific Property Names


Search for objects with specific property names using the -property option:


H = findobj(PB,'-property','HighSpeedInternet');
H.HighSpeedInternet


ans =


1M


The -property option enables you to omit the value of the property and search for
objects using only the property name.


Using Logical Expressions


Search for specific combinations of property names and values:


H = findobj(PB,'Name','Nancy Vidal','-and','Address','123 Main Street');
H.Number


ans =


5081234568


Find by Attribute Settings


All metaclasses derive from the handle class. You can use the handle findobj method
to find class members that have specific attribute settings.


For example, find the abstract methods in a class definition by searching the meta.class
MethodList for meta.method objects with their Abstract property set to true:


Use the class name in character format because class is abstract. You cannot create an
object of the class:


mc = meta.class.fromName('MyClass');


Find Objects with Specific Values
Free download pdf