matlab.System.setProperties - Set property values using name-value pairs when creating System object - MATLAB (original) (raw)
Class: matlab.System
Set property values using name-value pairs when creating System object
Syntax
setProperties(obj,numArgs,name1,value1,name2,value2,...) setProperties(obj,numArgs,arg1,...,argN,propValName1,...propValNameN)
Description
setProperties([obj](#bs4oogl-1%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8),[numArgs](#bs4oogl-1-numargs),[name1](#bs4oogl-1-name1name2),[value1](#bs4oogl-1-value1value2),name2,value2,...)
provides the name-value pair inputs to the System objectâ„¢ constructor. Use this syntax if every input must specify both name and value.
setProperties([obj](#bs4oogl-1%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8),[numArgs](#bs4oogl-1-numargs),`arg1,...,argN`,[propValName1,...propValNameN](#bs4oogl-1-propvalname1propvalnameN))
provides the value-only inputs, which you can follow with the name-value pair inputs to the System object during object construction. Use this syntax if you want to allow users to specify one or more inputs by their values only.
Input Arguments
System object handle used to access properties, states, and methods specific to the object. If your setProperties
method does not use the object, you can replace this input with ~
.
Number of inputs passed in by the object constructor
Value of property for value-only input to the object constructor.
Name of the value-only property to be set by the constructor.
Examples
Set up an MyFile
object so that when you use the System object, you can specify value-only inputs for VProp1
,VProp2
, and other property values via name-value pairs when constructing the object.
The following code shows the syntax of the constructor method needed for this situation.
methods function obj = MyFile(varargin) setProperties(obj,nargin,varargin{:},'VProp1','VProp2'); end end
Version History
Introduced in R2011b