get_author_list.m

来自「MAP Toolbox for matlab. World map includ」· M 代码 · 共 48 行

M
48
字号
% GET_AUTHOR_LIST : This function gets the author's name and author's
% special html number in cell matrix, "list". The variable "next_page_yesorno" 
% detects whether any author exists on the current page, thats why its useful 
% whether we should search authors on this current page and next pages.
%
%  Syntax>>
%    [next_page_yesorno,list]=get_author_list(input_url)
%
%  Class of "input_url" is char array
%  Class of "next_page_yesorno" is double array
%  Class of "list" is cell array

function [next_page_yesorno,list]=get_author_list(input_url)

url_content=urlread(input_url);
author_code='<td width="200"><a href="loadAuthor.do?objectType=author&objectId=';
author_exist=findstr(url_content,author_code);

empty_author_page=isempty(author_exist);
if empty_author_page==1
    next_page_yesorno=0;
    list=[];
else
next_page_yesorno=1;
author_start=findstr(url_content,author_code)+length(author_code);
for m=1:length(author_start)
author_num='';
for i=0:200
    if url_content(author_start(m)+i)~='"'
        author_num=[author_num url_content(author_start(m)+i)];
    else
        break,end
end
author_num_cell(m)=cellstr(author_num);
author_name='';
for i=2:200
    if url_content(author_start(m)+length(author_num)+i)~='<'
        author_name=[author_name url_content(author_start(m)+length(author_num)+i)];
    else
        break,end
end
author_name=author_name_correct(author_name);
author_name_cell(m)=cellstr(author_name);


end
list=[author_name_cell' author_num_cell'];
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?