23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exchanging Files over the Internet<br />

loadFileList.do?objectType=fileexchange&orderBy=date&srt3=0');<br />

% The strfind function searches for the word "Simulink".<br />

hits = strfind(recentFile,'Simulink');<br />

% The if statement checks for any hits.<br />

if ~isempty(hits)<br />

% If there are hits, the Web page will be saved locally<br />

% using the urlwrite function.<br />

urlwrite('http://www.mathworks.com/matlabcentral/fileexchange/<br />

loadFileList.do?objectType=fileexchange&orderBy=date&srt3=0',<br />

'contains_simulink.html');<br />

% The zip function creates a zip archive of the retrieved web<br />

page.<br />

zip('simulink_matches.zip','contains_simulink.html');<br />

% The setpref function supplies your e-mail address and SMTP<br />

% server address to <strong>MATLAB</strong>.<br />

setpref('Internet','SMTP_Server','mail.server.network');<br />

setpref('Internet', 'E_mail', 'youraddress@yourserver.com');<br />

% The sendmail function sends an e-mail with the zip archive of<br />

the<br />

% retrieved Web page attached.<br />

sendmail('youraddress@yourserver.com', 'New Simulink Files<br />

Found', 'New Simulink files uploaded to <strong>MATLAB</strong> Central. See<br />

attached zip archive.', 'simulink_matches.zip');<br />

end;<br />

Performing FTP File Operations<br />

From within <strong>MATLAB</strong>, you can connect to an FTP server to perform remote<br />

file operations. The following procedure uses a public MathWorks FTP server<br />

(ftp.mathworks.com). To perform any file operation on an FTP server, follow<br />

these steps:<br />

1 Connect to the server using the ftp function.<br />

6-121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!