Home > Back-end >  How to get the data from a download url with matlab?
How to get the data from a download url with matlab?

Time:09-14

I have the next URL: https://www.banxico.org.mx/SieInternet/consultarDirectorioInternetAction.do?accion=consultarSeries&locale=es&version=3&anoInicial=1996&anoFinal=2099&tipoInformacion=1,1&formatoHorizontal=false&metadatosWeb=true&series=SI744&formatoXLS.y=10 with it I can get an Excel file with this table: MME Prices I tried to use urlread,webread and readtable but they are not getting the data. webread gives this output: webread's output How could I get the data properly? I'm using matlab 2021a.

CodePudding user response:

If you use the function urlwrite and readtable in combination should works.

Example.

url = 'https://www.banxico.org.mx/SieInternet/consultarDirectorioInternetAction.do?accion=consultarSeries&locale=es&version=3&anoInicial=1996&anoFinal=2099&tipoInformacion=1,1&formatoHorizontal=false&metadatosWeb=true&series=SI744&formatoXLS.y=10';
fileName = 'file.xlsx';
urlwrite(url, fileName);
T = readtable(fileName,'Range','A18:B40');
  • Related