Development Environment |
Exchanging Files with the Internet
MATLAB provides a set of functions for exchanging files with the Internet. These include
Downloading URL Content
From within MATLAB, you can read and save the content of a URL. The urlread
function reads the content to a string variable in the MATLAB workspace. The urlwrite
function saves the content to a file.
Example--Retrieving Content from a URL
This example downloads the contents of the Top Authors list at MATLAB Central File Exchange, assigning the results to the string s
in the MATLAB workspace.
s = urlread('http://www.mathworks.com/matlabcentral/fileexchange/ TopFiles.jsp?type=category&id=&value=TopAuthors');
s
, such as
The next example downloads the files submitted for Signal Processing, Communications, and DSP from MATLAB Central File Exchange, saving the results to samples.html
in the MATLAB current directory.
urlwrite('http://www.mathworks.com/matlabcentral/fileexchange /Category.jsp?type=category&id=1','samples.html');
After downloading, you can view the file in your Web browser.
Closing a File | ZIP Functions |