フィルターのクリア

Retreive data from a website

1 回表示 (過去 30 日間)
Khalala Mamouri
Khalala Mamouri 2020 年 9 月 16 日
回答済み: Walter Roberson 2020 年 9 月 16 日
Hi, I am looking for a way to retreave multiple data from a website and store them in array in an effecient way, this is my code:
% Get the html for the webpage
html = webread("https://www.digikey.com/products/en/fans-thermal-management/thermal-heat-sinks/219");
% find the start and end of the data and remove the rest
iStart = strfind(html, "Thermal Resistance @ Forced Air Flow");
iStart = iStart(1);
iEnd = strfind(html, "Thermal Resistance @ Natural");
iEnd = iEnd(1);
html = html(iStart:iEnd);
% get the indexes of the start and finish of the data points
iStart = strfind(html, "<option value") +23;
iEnd = strfind(html, "</option")-1;
% pre-allocate results
results = strings(numel(iStart), 1);
% write and clean up results
for i = 1:numel(results)
results(i) = string(html(iStart(i):iEnd(i)));
results(i) = strrep(results(i), " ", "");
results(i) = strip(results(i));
end
Is there a better and simpler solution then this one ?

採用された回答

Walter Roberson
Walter Roberson 2020 年 9 月 16 日

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by