Splitting a long string into individual variables
7 ビュー (過去 30 日間)
古いコメントを表示
Calvin Spangler Young
2019 年 2 月 6 日
コメント済み: Calvin Spangler Young
2019 年 2 月 6 日
Hello--
I've got a long string of websites that looks like this:
"https://stgeorge"
"https://stjoseph"
"https://stlouis"
I've got them all as a string in variable X. I'm trying to use them with the webread command which requires that they be individual, so I'm looking for a way to split them all into their own variables or otherwise produce a way which I can collect data from all of the sites.
Any help is much appreciated! thanks!
4 件のコメント
採用された回答
Stephen23
2019 年 2 月 6 日
編集済み: Stephen23
2019 年 2 月 6 日
"... so I'm looking for a way to split them all into their own variables"
That would not be a good approach. Read this to know why:
"or otherwise produce a way which I can collect data from all of the sites."
Sure, that is easy! Just use a loop and basic, efficient indexing:
S = ["https://stgeorge", "https://stjoseph", "https://stlouis"];
N = numel(S);
C = cell(1,N);
for k = 1:N
C{k} = webread(S(k));
end
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Import Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!