webread not working for JSON

조회 수: 5 (최근 30일)
Leah
Leah . 2014년 12월 28일
댓글: Leah . 2014년 12월 30일
I can read from url's and api's just fine as long as the return format is not JSON. Some examples from matlab help that don't work for me
>> api = 'http://climatedataapi.worldbank.org/climateweb/rest/v1/';
url = [api 'country/cru/tas/year/USA'];
S = webread(url)
S =
Empty matrix: 0-by-1
But this works just fine:
fullURL = ['http://www.mathworks.com/matlabcentral/fileexchange' ...
'?term=urlread'];
str = urlread(fullURL);
>> whos str
Name Size Bytes Class Attributes
str 1x82552 165104 char
Has anyone else had this issue? It use to work just fine for me a few months ago. I wonder if it is some internet setting issue.
  댓글 수: 2
Leah
Leah 2014년 12월 30일
Thanks for your response Geoff. This magically started working and I haven't been able to reproduce the problem.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 JSON Format에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by