freelyControl={};

% find the folder
folder = uigetdir();

% get names of all mat files
matFileList = dir(fullfile(folder, '*.mat'));


% open files one by one and add the needed parameter to new cell structure
for i = 1:length(matFileList);
    cell = load(fullfile(folder, matFileList(i).name));
    freelyControl(i) = {cell.MDn};
end

save('freelyControl.mat','freelyControl');
% save('matFileList.mat','matFileList');


