Main Content

convert

Class: matlab.net.http.HeaderField
Namespace: matlab.net.http

Convert header field value to MATLAB type

Description

value = convert(fields) converts the Value property of each element of fields to a MATLAB® type.

For each header field in fields, MATLAB checks the matlab.net.http.field namespace for a class that supports a name with the same value as the fields.Name property. If the namespace contains a class for this field, then convert invokes the convert method of that class. To see the classes in the field namespace, call the matlab.net.http.HeaderField.displaySubclasses method.

If the conversion fails or if no class supports one of the fields.Name properties, then convert throws an exception.

This method does not work on heterogeneous arrays. All members of fields must be the same class.

example

Input Arguments

expand all

Header fields, specified as a vector of class objects from the matlab.net.http.field namespace. All members of fields must be the same class.

Output Arguments

expand all

Header field values, returned as a vector of MATLAB types. The types returned depend on the value of the specific class convert method.

Examples

expand all

Send a message to the Hubble Heritage website and display the year an image was modified.

uri = matlab.net.URI('http://heritage.stsci.edu/2007/14/images/p0714aa.jpg');
req = matlab.net.http.RequestMessage;
r = send(req,uri);
d = convert(getFields(r,'Last-Modified'));
LastModified = d.Year
LastModified =

        2007

Version History

Introduced in R2016b