Importing website information to Matlab

1 回表示 (過去 30 日間)
Erik Börgesson
Erik Börgesson 2019 年 12 月 30 日
コメント済み: Patrick Gipper 2020 年 1 月 5 日
Hello. How can I construct a function in order to obtain data from the following website: https://www.ultimatetennisstatistics.com/statsLeaders. As my function input, I want to type in the player names. And as output, I want to receive the Service Points Won (0<p<1) corresponding to the player name I type in as input.
Thank you, Erik

回答 (1 件)

Jalaj Gambhir
Jalaj Gambhir 2020 年 1 月 3 日
Hi,
A tedious way of doing it would be by using webread. This would return the HTML page source of the URL provided, which you can further extract your relevant information from. Other method would be to download the stats in a ‘.csv’ format from the website, individually for all the pages. You can then use these csv files to read the stats into a table.
For example:
Stats = readtable('StatisticsLeaders.csv')
You can access the names and values by: Stats.name and Stats.value.
  2 件のコメント
Adam Danz
Adam Danz 2020 年 1 月 3 日
There's a csv download link within the website - that would be the easiest approach IMO.
Patrick Gipper
Patrick Gipper 2020 年 1 月 5 日
Getting the correct format for the url can be a challenge. You can use Chrome Developer tools to capture a few network html interactions from the target website to see the expected formatting. I did this to get the url shown below. Then use webread to place the url response into a struct in your workspace. Once you have the data it can be manipulated however you please.
url='https://www.ultimatetennisstatistics.com/statsLeadersTable?rowCount=-1&sort%5Bvalue%5D=desc&searchPhrase=&category=aces&season=&fromDate=&toDate=&level=&bestOf=&surface=&indoor=&speed=&round=&result=&tournamentId=&opponent=&countryId=&minEntries=&_=1578183759846';
Stats=webread(url);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by