Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

setProperties

Class: matlab.System
Package: matlab

Set property values using name-value pairs

Syntax

setProperties(obj,numargs,name1,value1,name2,value2,...)
setProperties(obj,numargs,arg1,...,argN,propvalname1,...propvalnameN)

Description

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

obj

System object

numargs

Number of inputs passed in by the object constructor

name1,name2,...

Name of property

value1,value2,...

Value of the property

arg1,...argN

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

propvalname1,...propvalnameN

Name of the value-only property

Examples

expand all

Set up an object so users can specify value-only inputs for VProp1, VProp2, and other property values via name-value pairs when constructing the object.

methods
   function obj = MyFile(varargin)
      setProperties(obj,nargin,varargin{:},'VProp1','VProp2');
   end
end
Was this topic helpful?