您的位置:首页 > 理论基础 > 计算机网络

MatLab提取网络地址

2013-11-21 12:43 281 查看
clear;clc;

%initalize
UrlNums = 15;
urlpath{UrlNums}='';
url{UrlNums}='';
wb=waitbar(0,'Please wait...');

for i=1:length(urlpath)
waitbar(i/length(urlpath),wb,['have processed ',num2str(i),' urls'])
urlpath{i}=['http://www.ilovematlab.cn/thread-2209',num2str(54+i),'-1-1.html'] ;
tmp=urlread(urlpath{i});
%the type of regexp's result is cell.
%regex in matlab don't support gready match mode.
url(i)=regexp(tmp,'http.{10,53}\.wmv','match');
end
close(wb);
[fname,fpath]=uiputfile({'*.txt','Text(*.txt)'},'Please Save The File.','url.txt');
fid = fopen(fullfile(fpath,fname),'wt');
for i=1:length(url)
fprintf(fid,'%s\r\n',url{i});
end
fclose(fid);




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: