Main Content


Class: matlab.System

Set property values using name-value pairs when creating System object




setProperties(obj,numArgs,name1,value1,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,numArgs,arg1,...,argN,propValName1,...propValNameN) 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

expand all

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

Name of property to set.

Value of the property.

Value of property for value-only input to the object constructor.

Name of the value-only property to be set by the constructor.


expand all

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.

   function obj = MyFile(varargin)

Version History

Introduced in R2011b