Reading data from a different URL each iteration
1 回表示 (過去 30 日間)
古いコメントを表示
i am trying to read some data from a specific website, in this website there are some parametrs that we need to set to get the desired data, now reading the data for manually speccifed parametrs is an easy job. Now I am trying to automate this proceess such that the parametrs would be changed accordingly and the data for each set of parameters would be read directly without my interaction. to do that I have the follwoing URL that I am reading the data from
httpUrl = "https://lgdc.uml.edu/common/DIDBGetValues?ursiCode=JI91J&charName=foF2,foF1,foE,foEs,hmF2,hmF1,hmE" + ...
"&DMUF=3000&fromDate=1997%2F01%2F01+00%3A00%3A00&toDate=1997%2F12%2F31+11%3A59%3A00";
where the parameters that need to be changed in the URL every time are the following
fromDate=1997%2F01%2F01+00%3A00%3A00 % where we need to change the year eveery time which is here =1997
which represent the starting date of the desired data and
toDate=1997%2F12%2F31+11%3A59%3A00 % where we need to change the year eveery time which is here =1997
which represent the ending date of the desired data. I strated with the follwoing lines but I am not sure how I can make the URL change every time and store all the read data in a table at the end.
httpUrl = "https://lgdc.uml.edu/common/DIDBGetValues?ursiCode=JI91J&charName=foF2,foF1,foE,foEs,hmF2,hmF1,hmE" + ...
"&DMUF=3000&fromDate=1997%2F01%2F01+00%3A00%3A00&toDate=1997%2F12%2F31+11%3A59%3A00";
options = weboptions("ContentType", "text");
data = webread(httpUrl, options);
Iono= array2table(data);
0 件のコメント
採用された回答
Jan
2022 年 10 月 18 日
編集済み: Jan
2022 年 10 月 18 日
F = "https://lgdc.uml.edu/common/DIDBGetValues?ursiCode=JI91J&charName=foF2,foF1,foE,foEs,hmF2,hmF1,hmE" + ...
"&DMUF=3000&fromDate=%04d%%2F01%%2F01+00%%3A00%%3A00&toDate=%04d%%2F12%%2F31+11%%3A59%%3A00";
% % -> %%, then 1997 -> %04d
URL = sprintf(F, 1998, 1999)
3 件のコメント
Jan
2022 年 10 月 24 日
F = "https://lgdc.uml.edu/common/DIDBGetValues?ursiCode=%s&charName=foF2,foF1,foE,foEs,hmF2,hmF1,hmE" + ...
"&DMUF=3000&fromDate=%04d%%2F01%%2F01+00%%3A00%%3A00&toDate=%04d%%2F12%%2F31+11%%3A59%%3A00";
URL = sprintf(F, 'QQQQQQ', 1998, 1999)
The format %04d prints a number with 4 digits and leading zeros. %s inserts a string or CHAR vector.
You find an exhaustive explanation of the formats at:
doc sprintf
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!