Write values to nodes on OPC UA server
writeValue(
writes content of UaClient
,NodeList
,Values
)Values
, to the nodes identified by
NodeList
. You can browse for node objects using
browseNamespace
. You can also create nodes using
opcuanode
.
If NodeList
is a single node, then Values
is the
value written to the node. If NodeList
is an array of nodes,
Values
must be a cell array the same size as
NodeList
, and each element of the cell array is written to the
corresponding element of NodeList
.
The data type of the value you are writing does not need to match the node
ServerDataType
property. All values are automatically converted
before writing to the server. However, a warning or error is generated if the data type
conversion fails. For DateTime
data types, you can pass a MATLAB datetime
or a number; any numeric value can be interpreted as a MATLAB datetime.
To confirm what size arrays can be written to a node, check the
ServerValueRank
and ServerArrayDimensions
properties of the node:
A ServerValueRank
value of -3
indicates a
scalar or 1-dimensional array, -2
indicates any size array,
-1
indicates a scalar, 0
indicates an array
with 1 or more dimensions, and a positive value indicates the number of
dimensions.
If the number of dimensions is fixed, ServerArrayDimensions
is an array specifying the maximum possible length of each dimension. A value of
0
for a dimension length indicates no limit.
For example, if a node supports 2-dimensional arrays of a maximum size of
64-by-32, ServerValueRank
has a value of 2
and
ServerArrayDimensions
[64, 32]
.
writeValue(
writes content of NodeList
,Values
)Values
, to the nodes identified by
NodeList
. All nodes must be of the same connected client.