I have a main folder
within this folder are individual folders for each participant (32)
100514, 120414, .....310513 [all six digit ids]
participant = 1:size(nameFolds,1)
within each participant folder, there is another folder called Detection results
In this folder there are 40 folders '1_1', '1_2', ....'1_40'.
Within each of these are .csv files. I would like to take the file with name ending in
each of these contain a list of numbers and I would like to output the number of items and their average in a different csv file.
The code that has worked for me for one folder is
folder = 'D:\.....\MainFolder\100514\DetectionResults\1_1\';
csvFiles = dir(fullfile(folder, '*.csv'));
numfiles = length(csvFiles);
average = zeros(1, numfiles);
for k = 1:numfiles
M = csvread(fullfile(folder, csvFiles(k).name));
average(k) = mean(M(:,1));
csvwrite(fullfile(folder_out, 'output.csv'), average);
but i would like this to loop through the several folders and read those files ending in [1_1_FixationDuration.csv, 1_1_saccadeAmplitude.csv
1_1_saccadeDuration.csv] in particular, not any other .csv that may exist.