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!