How to store the result of a loop in a cell?
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone
i have a matrix R(12*44) and X(12*1). i'm trying to take a linear regression for each column of matrix R in a for loop and store in a cell such as b, but seems like it just stores the regression of the last column. can you please help. here is the script that i'm using.
X=[ones(size(R(:,1))) X];
b=cell(44,1);
for i=44
c=regress(R(:,i),X);
b{i}=c;
end;
Thank you
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!