Azzera filtri
Azzera filtri

How to load only a subset of .dat files into MATLAB?

3 visualizzazioni (ultimi 30 giorni)
Hello,
I am currently trying to load only a subset of files (i.e. files 1 to 6) into MATLAB using the following piece of code
cd('D:\Documents\Goldsmiths\Experiments\Curiosity x agency\Data pilot')
files=dir(fullfile('D:\Documents\Goldsmiths\Experiments\Curiosity x agency\Data pilot','_*.dat'));
for k=1:numel(files)
load(files(k).name);
end
This code works, in that it loads all files that end in .dat in the specified directory. But I only want files 1:6. I tried doing it this way
cd('D:\Documents\Goldsmiths\Experiments\Curiosity x agency\Data pilot')
files=dir(fullfile('D:\Documents\Goldsmiths\Experiments\Curiosity x agency\Data pilot','001*.dat','002*.dat','003*.dat','004*.dat','005*.dat','006*.dat'));
for k=1:numel(files)
load(files(k).name);
end
but it didn't get me the expected results.
Could you please be so kind as to help me?

Risposte (1)

Thorsten
Thorsten il 23 Giu 2016
for k=1:6
load(files(k).name);
end

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by