The resulting matrices have 4 rows because i goes from 3 to 4 and you use i as the row index when building the matrices.
To have the 3rd and 4th columns of IVOLI correspond to rows 1 and 2 of AIC and BIC, you can do this:
n_col = size(Mdl_vol,2);
AIC = zeros(2,n_col); % initialize the matrices to the right size
BIC = zeros(2,n_col);
for i = 3:4
for j = 1:n_col
EstMdl = estimate(Mdl_vol(j),IVOLI(:,i),'Display','off');
results = summarize(EstMdl);
AIC(i-2,j) = results.AIC;
BIC(i-2,j) = results.BIC;
end
end
Or you can do this, which is more general:
I_col_idx = [3 4];
n_row = numel(I_col_idx);
n_col = size(Mdl_vol,2);
AIC = zeros(n_row,n_col); % initialize the matrices to the right size
BIC = zeros(n_row,n_col);
for i = 1:n_row
for j = 1:n_col
EstMdl = estimate(Mdl_vol(j),IVOLI(:,I_col_idx(i)),'Display','off');
results = summarize(EstMdl);
AIC(i,j) = results.AIC;
BIC(i,j) = results.BIC;
end
end