Change values in or add fields to message header
msg = replaceFields(replaces
fields with the specified names to the indicated values specified in
returns the updated message.
This method is the same as the
changeFields method, but if a
field does not exist which matches the name or class, then the method adds a new one
to the end of the header instead of throwing an error.
FieldName1,FieldValue1,...,FieldNameN,FieldValueN— Fields defined by name-value pairs
Fields defined by name-value pairs.
specified as a string or character vector, and
is specified as any type valid for
To use the default value for the field, set
If the last value is missing, it is the same as specifying empty
newFields— Names to match
Names to match, specified as one of the following.
String vector, character vector, cell array of character vectors, or comma-separated list of strings or character vectors containing the names of the fields to replace. Names are not case-sensitive.
Vector or comma-separated list of one or more
HeaderField objects whose
Name properties are used to determine which
fields to replace. Names are not case-sensitive. Header field values
Vector or comma-separated list of
objects that are subclasses of
replaceFields method searches for names that
match names supported by the specified classes, regardless of the
class. If a subclass does not have a specific set of supported
names, all header fields of that subclass are matched regardless of
their names. Call the
method to see supported names.