Skip to main content

9.9) Obtaining Data From The Web


Matlab has functions that can help you "pull" data from the internet. You may want to have a script which automatically downloads recent data, or you may want to make your Matlab code portable without having to attach large data files.

  • urlread - Downloads a URL's content to a string. The URL includes the transfer protocol. E.g. http or ftp
  • urlwrite - Downloads a URL's content to a file
  • [matlab]
    % URL is a string of the url and filename is the name of the file you want to save
    full_url='http://www.metoffice.gov.uk/hadobs/hadisst/data/HadISST1_SST_2013.txt.gz'
    filename='HadISST1_SST_2013.txt.gz'
    urlwrite(full_url, filename)
    gunzip(filename)
    [/matlab]