Concatenate generalized linear model objects

Hello everybody, I use fitglm to fit several generalized linear models, for instance:
fit1 = fitglm(X,Y,'linear','distr','gamma','link','log');
fit2 = fitglm(X,Y,'linear','distr','gaussian','link','log');
fit3 = fitglm(X,Y,'linear','distr','gamma','link','identity');
...
I would like to create an "array" of these objects, so that I could write something like this to access them:
fit(1), fit(2),...
but I couldn't find a way! Can you please help me out? Thanks!

 채택된 답변

Kelly Kearney
Kelly Kearney 2015년 3월 25일

0 개 추천

You can use cell arrays:
fit = cell(3,1);
fit{1} = fitglm(X,Y,'linear','distr','gamma','link','log');
fit{2} = fitglm(X,Y,'linear','distr','gaussian','link','log');
fit{3} = fitglm(X,Y,'linear','distr','gamma','link','identity');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2015년 3월 25일

답변:

2015년 3월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by