set
Set property values for audiorecorder
object
Syntax
set(
obj
,Name
,Value
)
set(obj
,cellOfNames
,cellOfValues
)
set(obj
,structOfProperties
)
settableProperties
= set(obj
)
Description
set(
sets the named property to the specified value for the object obj
,Name
,Value
)obj
.
set(
sets
the properties listed in the cell array obj
,cellOfNames
,cellOfValues
)cellOfNames
to
the corresponding values in the cell array cellOfValues
.
Each cell array must contain the same number of elements.
set(
sets
the properties identified by each field of the structure array obj
,structOfProperties
)structOfProperties
to
the values of the associated fields.
returns the names of the properties that you can set in a structure
array. The field names of settableProperties
= set(obj
)settableProperties
are
the property names.
Examples
View the list of properties that you can set for an audiorecorder
object:
recorderObj = audiorecorder; set(recorderObj)
Set the Tag
and UserData
properties
of an audiorecorder
object using a structure array:
newValues.Tag = 'My Tag'; newValues.UserData = {'My User Data', pi, [1 2 3 4]}; recorderObj = audiorecorder; set(recorderObj, newValues) % View the values all properties. get(recorderObj)
Tips
The set
function allows combinations of property
name/value pairs, cell array pairs, and structure arrays in the same
function call.
Alternatives
To set the value of a single property, you can use dot notation.
Reference each property as though it is a field of a structure array.
For example, set the Tag
property for an object
called recorderObj
(as created in the Examples):
recorderObj.Tag = 'This is my tag.';
This command is exactly equivalent to:
set(recorderObj, 'Tag', 'This is my tag.');