MATLAB: Assign values of .mat files into matrix

mat filesMATLABorganize variables

Dear all,
I have multiple .mat files (see attachment). I want to organize the MFR_mod variables within the those .mat files into one matrix. I feel like there is a smarter way then what I tried below. This will take me forever, since MFR_mod goes from 1 until 81.
for ii = 1:20
load(['silomodresults',num2str(ii),'.mat'])
end
MFR_tot = [MFR_mod1; MFR_mod2; MFR_mod3; MFR_mod4; MFR_mod5; MFR_mod6; MFR_mod7; MFR_mod8; MFR_mod9; MFR_mod10; MFR_mod11; MFR_mod12; MFR_mod13; MFR_mod14; MFR_mod15; MFR_mod16; MFR_mod17; MFR_mod18; MFR_mod19; MFR_mod20];

Best Answer

D = 'path to the folder where the files are saved';
S = dir(fullfile(D,'silomodresults*.mat'));
C = {};
for k = 1:numel(S)
F = fullfile(D,S(k).name);
T = load(F,'-regexp','^MFR_mod\d+$');
N = fieldnames(T);
V = str2double(regexp(N,'\d+','once','match'));
C(V) = struct2cell(T); %#ok<SAGROW>
end
M = vertcat(C{:}); % optional
Giving:
>> size(M)
ans =
81 1
>> plot(M)