webread error with input ??

Hi,
I am using webread for the first time in R2017b. Very unusual behavior :
>> webread('https://www.mathworks.com/matlabcentral')
Error using webread (line 119)
First input must be a string array or cell array of character vectors.
But urlread works fine
>> urlread('https://www.mathworks.com/matlabcentral')
ans =
'<!DOCTYPE HTML>
<html>
<head>
Any clue ? Tried restarting Matlab, no help.

9 comentarios

Rik
Rik el 13 de Jun. de 2018
Odd. I can't reproduce this on R2017b (W10). Digging into the webread function I found out that line 119 is the following code
[url, options] = encodeInputs(url, queryParams, options);
This should not error, as you input is just a char array. Does this same error occur when you try to input it as a string or a cellstr?
Yes. I tried
webread({'https://www.mathworks.com/matlabcentral'})
Error using webread (line 119)
Expected URL to be one of these types:
char, string, matlab.net.URI
Instead its type was cell.
without success.I agree this is very odd.
Could it come from the default weboptions ?
options =
weboptions with properties:
CharacterEncoding: 'auto'
UserAgent: 'MATLAB 9.3.0.713579 (R2017b)'
Timeout: 5
Username: ''
Password: ''
KeyName: ''
KeyValue: ''
ContentType: 'auto'
ContentReader: []
MediaType: 'application/x-www-form-urlencoded'
RequestMethod: 'auto'
ArrayFormat: 'csv'
HeaderFields: []
CertificateFilename: 'C:\bin\MATLAB\R2017b\sys\certificates\ca\rootcerts.pem'
Nirav Sharda
Nirav Sharda el 15 de Jun. de 2018
Can you provide the output of the following command?
which -all webread
Here
>> which -all webread
C:\bin\MATLAB\R2017b\toolbox\matlab\external\interfaces\webservices\restful\webread.m
Nirav Sharda
Nirav Sharda el 18 de Jun. de 2018
Can you attach the webread.m file mentioned on the above path?
Christopher Coello
Christopher Coello el 18 de Jun. de 2018
Here it is
By the way, trying everytime I start R2017b, but still get the same error.
>> webread(sprintf('%s','https://www.mathworks.com/matlabcentral'))
Error using webread (line 119)
First input must be a string array or cell array of character vectors.
Nirav Sharda
Nirav Sharda el 18 de Jun. de 2018
Editada: Nirav Sharda el 18 de Jun. de 2018
Line 119 of the 'webread' function as mentioned in the error calls the 'encodeInputs' function which in-turn calls another internal function. Can you add break-points in the code and identify the line causing the issue?

Iniciar sesión para comentar.

Respuestas (0)

Productos

Versión

R2017b

Etiquetas

Preguntada:

el 13 de Jun. de 2018

Editada:

el 18 de Jun. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by