set
Class: matlab.mixin.SetGet
Namespace: matlab.mixin
Assign property values
Syntax
set(H,Name=Value)
set(H,pn,pv)
set(H,s)
set(H,___)
sOut = set(H)
cOut = set(H,propname)
Description
set(
sets property values for
the objects in a handle array. This syntax sets property values in handle array
H
,Name=Value)H
using the Name=Value
syntax. Replace
Name
with the property name and Value
with the
value for the property. You can include multiple name-value pairs.
set(
sets the properties in the cell array of strings H
,pn
,pv
)pn
to the
corresponding values in the cell array pv
for all objects in
H
. The dimensions of cell array pn
must be
1
-by-n
(where n
is the
number of property names), but the cell array pv
can be
m
-by-n
where m
is equal to
length(H)
.
set(
sets the
properties identified by each field name of the structure H
,s
)s
with the
values contained in s
.
set(
sets properties using
any combination of the previous syntaxes. If you combine cell array or struct inputs
with arguments using the H
,___)Name=Value
syntax, you must add the
Name=Value
arguments at the end of the argument list.
returns
the user-settable properties of scalar sOut
= set(H
)H
. S
is a
struct
whose field names are the property names, and the values
are either empty cell arrays or cell arrays of values for properties that have a finite
set of predefined possible values.
returns a cell array of possible values for the property cOut
= set(H
,propname
)propname
if that property has a finite set of predefined values. If the property does not have a
finite set of predefined values, the cell array is empty.
Input Arguments
Output Arguments
Examples
Set the value of a property named Data
on an instance of a class that derives from matlab.mixin.SetGet
.
set(obj,'Data',[1 2 3 4])
Tips
set
matches partial and case-insensitive names that are not ambiguous. Inexact name matching applies only to class properties. Dynamic properties require exact name matches.Override the
matlab.mixin.SetGet
classsetdisp
method to change how MATLAB® displays information returned byset
.