matlab.net.http.Message.replaceFields - Change values in or add fields to message header - MATLAB (original) (raw)

Class: matlab.net.http.Message
Namespace: matlab.net.http

Change values in or add fields to message header

Syntax

Description

msg = replaceFields([msg](#mw%5Fd5777fc0-3110-41f1-9fae-399c1b02a28d%5Fsep%5Fshared-msg),[FieldName1,FieldValue1,...,FieldNameN,FieldValueN](#mw%5F44a56f17-26fb-459d-899f-1aac3e665141))replaces fields with the specified names to the indicated values specified inFieldName1,FieldValue1,...,FieldNameN,FieldValueN and 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.

msg = replaceFields([msg](#mw%5Fd5777fc0-3110-41f1-9fae-399c1b02a28d%5Fsep%5Fshared-msg),[newFields](#mw%5Fd5777fc0-3110-41f1-9fae-399c1b02a28d%5Fsep%5Fref%5Fq3fxxdid06-ids)) replaces the existing fields in each message to the names, values, and types specified in newFields and returns the updated message.

Input Arguments

expand all

Fields defined by name-value pairs. FieldName is specified as a string or character vector, and FieldValue is specified as any type valid for FieldName.

To use the default value for the field, set FieldValue to ''.

If the last value is missing, it is the same as specifying empty ([]).

Names to match, specified as one of the following.

Version History

Introduced in R2016b