matlab.net.http.HeaderField.convert - Convert header field value to MATLAB type - MATLAB (original) (raw)
Main Content
Class: matlab.net.http.HeaderField
Namespace: matlab.net.http
Convert header field value to MATLAB type
Syntax
Description
[value](#ref%5Fq3fxxcm5d6-value) = convert([fields](#ref%5Fq3fxxcm5d6-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 thefields.Name
property. If the namespace contains a class for this field, then convert
invokes theconvert
method of that class. To see the classes in thefield
namespace, call thematlab.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
Header fields, specified as a vector of class objects from thematlab.net.http.field
namespace. All members offields
must be the same class.
Output Arguments
Header field values, returned as a vector of MATLAB types. The types returned depend on the value of the specific class convert
method.
Examples
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
Version History
Introduced in R2016b