複数のcsvファイルを一度に読み込みたい
Show older comments
同じフォルダに1stcap01.csv, 1stcap02.csv,1stcap03.csv . . . と複数のファイルがある時に
以下の処理を用いて、それぞれのデータの読み込みを同時に行いたいです。
1つ1つ処理をすれば良いのですが、csvファイルの数が多いため、何か良い方法がありましたらご教示いただけると幸いです。
data = readmatrix('1stcap01.csv');
idx = isnan(data(:,2));
idx_or =[0;diff(idx)]<0|[diff(idx);0]>0;
num = find(idx_or);
if mod(length(num),2)
num = [num;height(idx_or)];
end
for ii = 1:length(num)/2
A{ii,1} = data(num(2*ii-1):num(2*ii),:);
end
B = cellfun(@(x) rmmissing(x,2),A,'UniformOutput',false);
cellfun(@size,B,'UniformOutput',false)
よろしくお願いいたします。
Accepted Answer
More Answers (0)
Categories
Find more on スプレッドシート in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!