This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Configure or display OPC Toolbox object properties


Prop = set(Obj)
Prop = set(Obj,'PropertyName')


set(Obj) displays property names and any enumerated values for all configurable properties of OPC Toolbox™ object Obj. Obj must be a single toolbox object.

Prop = set(Obj) returns all property names and their possible values for object Obj. Obj must be a single object. The return value, Prop, is a structure whose field names are the property names of Obj, and whose values are cell arrays of possible property values or empty cell arrays if the property does not have a finite set of possible character vector values.

set(Obj,'PropertyName') displays the possible values for the specified property, PropertyName, of toolbox object Obj. Obj must be a single object.

Prop = set(Obj,'PropertyName') returns the possible values for the specified property, PropertyName, of object Obj. The returned array, Prop, is a cell array of possible value character vectors or an empty cell array if the property does not have a finite set of possible character vector values.

set(Obj,'PropertyName',PropertyValue) sets the value, PropertyValue, of the specified property, PropertyName, for object Obj. Obj can be a vector of toolbox objects, in which case set sets the property values for all the objects specified.

Note that if Obj is connected to an OPC server, configuring server-specific properties such as UpdateRate and DeadbandPercent might be time consuming.

set(Obj,S) where S is a structure whose field names are object property names, sets the properties named in each field name to the values contained in the structure.

set(Obj,PN,PV) sets the properties specified in the cell array of character vectors or string array, PN, to the corresponding values in the cell array PV, for all objects specified in Obj. The cell array PN must be a vector, but the cell array PV can be M-by-N, where M is equal to length(Obj) and N is equal to length(PN), so that each object will be updated with a different set of values for the list of property names contained in PN.

set(Obj,'PropName1',PropValue1,'PropName2',PropValue2,...) sets multiple property values with a single statement.

Note that it is permissible to use name-value pairs, structures, and name-value cell array pairs in the same call to set.


Create an opcda object and add a group to that object.

da = opcda('localhost','Dummy.Server'); 
grp = addgroup(da,'SetExample');

Set the opcda object’s Timeout to 300 seconds, and restrict the event log to 2000 entries.


Set multiple properties using cell array pairs.

set(da,{'Name','ServerID'},{'My Opcda object','OPC.Server.1'});

Set the group name.


Query the permissible values for the group’s Subscription property.



As an alternative to the set function, you can directly assign property values using dot-notation. The following two lines achieve the same result.

daObj.Timeout = 10;

See Also


Introduced before R2006a