Pulling certain data from a text file into Matlab with strsplit
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I want a function that reads this text file. It would be better if this could be read with fgetl and strsplit.Thanks!
0 件のコメント
回答 (1 件)
Star Strider
2022 年 1 月 25 日
Try something like this —
% opts = weboptions('ContentType','text');
% M = webread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/873530/miktos1.txt', opts)
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/873530/miktos1.txt', 'ReadVariableNames',0)
for k = 1:size(T1,1)
Var2stsp{k,:} = strsplit(T1{k,2}{:},' ');
end
Var2stsp{1}
Var2stsp{2}
Var2stsp{end-1}
Var2stsp{end}
Experiment to get the desired result.
.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!