How can I get a table from an url?

조회 수: 2 (최근 30일)
Adriano
Adriano 2021년 10월 6일
편집: Meet 2024년 7월 30일
Hi all,
I need to get in matlab the table from this url:
I tried with webread and urlreadtable functions but it doesn't work. Someone can help me? Many thanks!

답변 (1개)

Meet
Meet 2024년 7월 30일
편집: Meet 2024년 7월 30일
Hi Adriano,
I have successfully replicated the issue you encountered while attempting to fetch the table. Unfortunately, the "webread" function in MATLAB is not equipped to execute JavaScript; it can only retrieve the raw HTML content from a URL.
To address the issue, I recommend using the following API endpoint:
which I found it from the Web Inspect and this directly provides the table in CSV format. You can then utilize the "readtable" function in MATLAB to read the table. Here is an example:
csvUrl = 'https://www.cambriafunds.com/assets/data/FilepointCambria.40C1.C1_ETF_Holdings.csv';
dataTable = readtable(csvUrl);
The above workaround will only work as long as the URL for the csv file is not changed by the website host.
For more information, you can refer to the following documentation links:

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by