ループ内でテーブルを番号つきで管理する方法
Show older comments
フォルダ内のdatファイルをすべて読み込み、fie1,fie2...というtableで管理したいのですが
知恵をいただけないでしょうか。
datFileList = dir(['*.dat']);
datNum = size(datFileList);
kk = 1;
for kk = 1 : datNum(1)
disp(kk)
datFileName = char(datFileList(kk).name); % char型に変換
HeaderlinesIn=6;
tmp = importdata(datFileName,'\t',HeaderlinesIn); %headerと数値を分けてimport
headname=strrep(tmp.colheaders,'%','percent'); %headerの名前の調整、%は変数名として使えないので
vcell = genvarname(headname); %変数名がかぶらないように処理
fie{kk}= array2table(tmp.data,'VariableNames',vcell); %変数と数値を合わせてtable化
end
Accepted Answer
More Answers (0)
Categories
Find more on table in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!