![]() |
Exploiting MATLAB's Data Structures |
The get and set functions are
vectorized so that when used with more than one handle all the property
values can be retrieved or set in one operation. The expression
s = get(h)
returns a structure containing as fields the names of the properties for the given handles (which all must be the same type) and their associated values. The dual syntax
set(h,s)
sets all the properties at once.
The expression
val = get(h,{'prop1','prop2',...})
returns a cell array containing the specified property values for the given handles. The dual syntax
set(h,{'prop1','prop2',...},values)
is used to set the specified properties to the values in the values
cell array.
You can use these expressions to vectorize operations on handle graphics objects.
Goal: Change all the text colors in an axis to their complements.
Key concepts: handles, vectorized set and get, structures, cell arrays
Key functions: set, get, findobj,
sillytext
![]()
Copyright © 1997 The MathWorks, Inc.
clay@mathworks.com
$Revision$ $Date$