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

5 vues (au cours des 30 derniers jours)
SM
SM le 9 Juil 2020
Commenté : SM le 11 Juil 2020
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?"

Réponse acceptée

KSSV
KSSV le 9 Juil 2020
datFiles = dir("*.dat");
N = length(datFiles) ;
% loop for each file
for i = 1:N
thisFile = datFiles(i).name ;
% do what you want
end

Plus de réponses (0)

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by