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.

convert

Class: matlab.net.http.HeaderField
Package: matlab.net.http

Convert header field value to MATLAB type

Syntax

value = convert(fields)

Description

example

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 package for a class that supports a name with the same value as the fields.Name property. If the package contains a class for this field, then convert invokes the convert method of that class. To see the classes in the field package, 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.

Input Arguments

expand all

Header fields, specified as a vector of class objects from the matlab.net.http.field package. 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

Introduced in R2016b