How do I import multiple .dat files from a folder in Matlab?

26 ビュー (過去 30 日間)
SM 2020 年 7 月 9 日
コメント済み: SM 2020 年 7 月 11 日
I have multiple folders such as Instance01, Instance02, Instance03, etc and each folder contains many ".dat" files which are named as time.dat, cost.dat, pred.dat, etc. In my problem, i first works on the .dat files in folder Instance01, once execution is done, Instance02 needs to be accessed and so on. Now my question is that "How can I access all the .dat files in each folder sequentially?"


KSSV 2020 年 7 月 9 日
datFiles = dir("*.dat");
N = length(datFiles) ;
% loop for each file
for i = 1:N
thisFile = datFiles(i).name ;
% do what you want
  1 件のコメント
SM 2020 年 7 月 11 日
Thank you! You made my work easy.


その他の回答 (0 件)


Help Center および File ExchangeLarge Files and Big Data についてさらに検索


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by