Hello, I am trying to extract data with the websave function from an api, with an url I am certain is valid and correct when I type it into a browser. However, MATLAB seem to not recognize the url as a valid one. The weird thing is that somehow it works when I remove the last part "&timeformat=%Y%m%d%H".
And there's the simple code that I'm using to extract the numbers:
clc
clear all
api = 'http://api.mesowest.net/v2/stations/timeseries?stid=knyc&start=201001010000&end=201512312359&token=1234567890&vars=air_temp,relative_humidity&timeformat=%Y%m%d%H'; filename = 'KNYC.txt'; options = weboptions('Timeout',Inf); outfilename = websave(filename,api,options);
Thanks in advance!
Yilan

 채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 1일

0 개 추천

You need to percent encode your percent symbols. Change the % to %25 in each location

댓글 수: 1

Janice Sanderson
Janice Sanderson 2016년 2월 1일
It totally worked!! Thank you so much you have no idea how grateful I am!!
Yilan

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by