How to get data from a website

조회 수: 1 (최근 30일)
Adriano
Adriano 2020년 12월 18일
댓글: Adriano 2020년 12월 18일
Hi all,
I need to get "Ongoing charge" data (0,11%) from this url:
How can I do it? I tried using webread function but I didn't find the information. Thanks to all!
Regards

채택된 답변

Rik
Rik 2020년 12월 18일
I can't tell you what you did wrong, because you decided not to post what you have tried. That meant I had to write your code from scratch. I resisted the urge to extract a different parameter and let you modify the code to get to the proper result.
x=webread('https://markets.ft.com/data/funds/tearsheet/summary?s=LU0323048693:EUR');
pat='<th>Ongoing charge</th>';
ind1=strfind(x,pat);ind1=ind1(1)+numel(pat);
ind2=strfind(x,'</td>');ind2(ind2<ind1)=[];ind2=ind2(1);
x((ind1+4):(ind2-1))
ans = '0.11%'
  댓글 수: 1
Adriano
Adriano 2020년 12월 18일
Hi Rik!
thanks for your answer. I was using your string:
x=webread('https://markets.ft.com/data/funds/tearsheet/summary?s=LU0323048693:EUR')
than I press ctrl+F in the command windows looking for the string "ongoing charge", but I didn't find it. I don't know why. Thanks for your code, it works!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by