User`s guide
Compose and Code GUIs with Interactive Tools
Help system that contains doc examples. See “View and Run the setprop
Function” on page 11-68. Property values need not be character strings. T he
setprop function correctly translates the following MATLAB data types to
text within
set comm ands it generates:
• Character strings
• Cell arrays (except cell arrays that contain other cell arrays)
• Numeric types (scalar, vector, matrix)
• Object handles
• Function handles
Because it encodes strings, cell arrays, and function handles,
setprop can
output callbacks, such as a
ButtonDownFcn, Callback, CloseRequestFcn ,and
so on. T he function returns a “set string” for a component. You normally
specify the component handle and the name of one of its properties. If you
alsoprovideavaluefortheproperty,
setprop first sets and then returns the
new value inside the set string. Here is the help text for the function:
function setstr = setprop(objhandl e, property, value)
Generates a SET statement for a property of an object.
Copy the statement and past e it into your GUI code.
setstr = setprop places the current figure in plot edit mode
for you to select a uicontr ol or other object. It then opens
a GUI listing all propertie s of the selcted object. When you
select a property, a SET command is return ed for the current
value of that property. Whe n called with no arguments, SETPROP
returns a SET command that contains a gene ric name for the
object, such as "pushbutton", which you should replace with
the actual variable name of its handle.
setstr = setprop(objhandle) opens a GUI li stin g all properties
of objhandle , the handle of an HG object. When you choose one,
a SET command is returned for the current value of the property
you selected .
setstr = setprop(objhandle,prop erty) returns a SET command
11-65