필터 지우기
필터 지우기

How can I get a table from a website?

조회 수: 3 (최근 30일)
Aidan
Aidan 2023년 12월 23일
답변: Sulaymon Eshkabilov 2023년 12월 23일
I am trying to pull the table from the following website into matlab:
I have tried using the readtable function which has worked on other websites but not this one. I assume the table on the attached website is formated in a different way (I really don't know much about this area/websites). How can I write a function to pull the data in the attached website into a matlab table?
Thanks!

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 23일
How about this (it is not a complete answer, but it can be worked around :) .. ):
URL = 'https://www.cbssports.com/fantasy/football/stats/posvsdef/RB/DAL/teambreakdown/standard';
DATA = readtable(URL, FileType="html",ReadVariableNames=false)
DATA = 58×13 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 ____ _____________________________ ____ ____ ____ ____ ____ ____ ____ _____ _____ _____ _____ NaN <missing> NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <missing> NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN "Team" NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1 "Giants RB vs Cowboys [+]" 15 65 4.33 0 7 6 15 2.5 0 0 7 NaN "Barkley, Saquon" 12 51 4.25 0 4 3 12 4 0 0 6 NaN "Brightwell, Gary" 1 5 5 0 2 2 6 3 0 0 0 NaN "Breida, Matt" 2 9 4.5 0 1 1 -3 -3 0 0 0 2 "Jets RB vs Cowboys [+]" 10 24 2.4 0 5 2 8 4 0 1 0 NaN "Carter, Michael" 2 8 4 0 2 1 3 3 0 0 0 NaN "Hall, Breece" 4 9 2.25 0 2 0 0 0 0 0 0 NaN "Cook, Dalvin" 4 7 1.75 0 1 1 5 5 0 1 -2 3 "Cardinals RB vs Cowboys [+]" 21 113 5.38 1 3 3 26 8.67 0 0 19 NaN "Conner, James" 14 98 7 1 2 2 18 9 0 0 16 NaN "Ingram, Keaontay" 5 13 2.6 0 1 1 8 8 0 0 1 NaN "Demercado, Emari" 2 2 1 0 0 0 0 0 0 0 0 4 "Patriots RB vs Cowboys [+]" 20 46 2.3 0 6 4 16 4 0 0 5
DATA(1:3,:)=[]
DATA = 55×13 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 ____ _____________________________ ____ ____ ____ ____ ____ ____ ____ _____ _____ _____ _____ 1 "Giants RB vs Cowboys [+]" 15 65 4.33 0 7 6 15 2.5 0 0 7 NaN "Barkley, Saquon" 12 51 4.25 0 4 3 12 4 0 0 6 NaN "Brightwell, Gary" 1 5 5 0 2 2 6 3 0 0 0 NaN "Breida, Matt" 2 9 4.5 0 1 1 -3 -3 0 0 0 2 "Jets RB vs Cowboys [+]" 10 24 2.4 0 5 2 8 4 0 1 0 NaN "Carter, Michael" 2 8 4 0 2 1 3 3 0 0 0 NaN "Hall, Breece" 4 9 2.25 0 2 0 0 0 0 0 0 NaN "Cook, Dalvin" 4 7 1.75 0 1 1 5 5 0 1 -2 3 "Cardinals RB vs Cowboys [+]" 21 113 5.38 1 3 3 26 8.67 0 0 19 NaN "Conner, James" 14 98 7 1 2 2 18 9 0 0 16 NaN "Ingram, Keaontay" 5 13 2.6 0 1 1 8 8 0 0 1 NaN "Demercado, Emari" 2 2 1 0 0 0 0 0 0 0 0 4 "Patriots RB vs Cowboys [+]" 20 46 2.3 0 6 4 16 4 0 0 5 NaN "Stevenson, Rhamondre" 14 30 2.14 0 3 2 10 5 0 0 4 NaN "Elliott, Ezekiel" 6 16 2.67 0 3 2 6 3 0 0 1 5 "49ers RB vs Cowboys [+]" 35 141 4.03 2 8 6 53 8.83 1 1 35

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by