Creating a nested loop
显示 更早的评论
Suppose I want to generate a 2 x 9 matrix by looping the following code twice
for j = 1:size(Mdl_vol,2)
EstMdl = estimate(Mdl_vol(j),IVOLI(:,1),'Display','off');
results = summarize(EstMdl);
AIC(j) = results.AIC;
BIC(j) = results.BIC;
end
I tried this;
for i = 3:4
for j = 1:size(Mdl_vol,2)
EstMdl = estimate(Mdl_vol(j),IVOLI(:,i),'Display','off');
results = summarize(EstMdl);
AIC(i,j) = results.AIC;
BIC(i,j) = results.BIC;
end
end
but it gives me a 4x9 matrix for some reason
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!