CSVファイルから特定の列のデータのみ取得する方法
Show older comments
Matlab2018aを使用しています。 メモリ節約のため、textscanで600000行のCSVデータを20000行ずつ読み込み、 3列目のデータの20000個の平均を算出したいと思っています。 下記のようなプログラムを書いたのですがループが入れ子になっており 速度が遅いです。 data{1}は20000x1 のcell型配列になっています。 data{1}から3列目のデータを20000個素早く取得する方法はないでしょうか。
for i=1:30
data = textscan(fileID, '%s', 20000);
% 20000回ループ
for j=1:length(data{1})
% CSVデータの3列目のみを2000個取得
end
% 取得した2000個のデータを平均する処理
end
close(fileID);
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!