Reputation: 517
Assuming I have X .mat
files under a directory called my_experiment_1/data
, I know I can load them into
experiment1_files = dir(['my_experiments/data/*.mat']);
Now I would like to open them in a for
loop with the .name
extension of dir
:
for count = 1:N
% load data-set
load(experiment1_files(count).name);
...
end
and perform a bunch of operations with the matrices of each file.
Question: what is the way to compute the number of files withing a directory in MATLAB (meaning, the number N
in the for
-loop above)?
Upvotes: 0
Views: 1187