MATLAB Object-Oriented Programming

(Joyce) #1

CV =


'..'
'--'


When H is an array of handles and you do not specify a property name, get returns a
struct array containing fields with names corresponding to property-names. Assign the
output of get to a variable when H is not scalar.


SV = get(H)


SV =


2x1 struct array with fields:
Style
Marker
Units


Get the value of the Marker property from the second array element in the SV array of
structures:


SV(2).Marker


ans =


q


Arrays of Handles, Names, and Values


You can pass an array of handles, a cell array of property names, and a cell array of
property values to set. The property value cell array must have one row of property
values for each object in H. Each row must have a value for each property in the property
name array:


H = [LineType('..','z'),LineType('--','q')];
set(H,{'Style','Marker'},{'..','o';'--','x'})


The result of this call to isset:


H(1)


ans =


LineType with properties:


Implement Set/Get Interface for Properties
Free download pdf