Open OpenWeatherMap API in matlab
15 views (last 30 days)
I just need to know the weather at a current position.
I have the following script, but it doesn't work.
key = 'MyKey';
op = 'TA2';
z = '1';
x = '51.36';
y = '6.16';
options = weboptions('ContentType','json');
url = ['http://maps.openweathermap.org/maps/2.0/weather/TA2/',z,'/',x,'/',y,'?date=1527811200&opacity=0.9&fill_bound=true&appid=',key];
Current_Data = webread(url, options);
Can anyone tell me what is going wrong here? I got the folowing URL from OpenWeatherMap:
Thanks in advance
Yongjian Feng on 22 Jul 2021
What does it mean by "it doesn't work"? Any error message you saw?
Try the html directly outside matlab and make sure it works first. You can use curl from command line window.