for文を使用して、現在のフォルダ内にある3つのcsvファイルを1つのリスト型として格納するにはどうすれば良いですか?
Show older comments
% 現在のフォルダ内にある3つのcsvを抽出
Pathlists = dir("*.csv");
% 抽出したcsv構造をセルに変換
Mylists = (struct2cell(Pathlists))';
% 全行と1列目、2列目を文字列として抽出
Mylists = string(Mylists(:,1:2));
% 完全なファイル仕様に変換
MyPath = fullfile(Mylists(:,2),Mylists(:,1));
% 空リストを作成し、以下のようなデータ型を作成したい
% data = [[file1], [file2], [file3]] 各データの値1801×11 table
data = []; % 空リスト
for n = 1:length(Pathlists)
data = readtable(MyPath(n));
end
>> data % file3のtableしか格納されないのはなぜでしょうか?
Accepted Answer
More Answers (0)
Categories
Find more on Data Import from MATLAB 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!