|
"AHMET ANIL DINDAR" <adindar@iku.edu.tr> wrote in message <iaf2k0$ghb$1@fred.mathworks.com>...
> Hi all,
> I'd like to read a specific part of a web page. In html code, it is placed between <pre> and </pre>.
> I tried using "urlread" in MATLAB but it seems it takes me to somewhere complicated.
>
> Any idea?
>
> Ahmet
Use STRFIND to find the first '<pre>' and the first '</pre>'
Here's a snippet from my function GUNITS on the FEX which does just this only looking for <b>.
S = urlread...
strinit = strfind(lower(S),'<b>');
strend = strfind(lower(S),'</b>');
if isempty(strinit) || isempty(strend)
error('Please try again!');
end
strinit = strinit(1);
strend = strend(strend>strinit);
strend = strend(1);
%Output the answer (remove the <b>, < found earlier)
outStr = S(strinit+3:strend-1);
|