Effacer les filtres
Effacer les filtres

How can I get a table from a website?

3 vues (au cours des 30 derniers jours)
Aidan
Aidan le 23 Déc 2023
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!

Réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 23 Déc 2023
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

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by