for文を使用して、現在のフォルダ内にある3つのcsvファイルを1つのリスト型として格納するにはどうすれば良いですか?
显示 更早的评论
% 現在のフォルダ内にある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しか格納されないのはなぜでしょうか?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!