Extract row each iteration
1 次查看(过去 30 天)
显示 更早的评论
I would like to extract a 1-row vector "K" that changes each iteration and create a matrix "C" with rows equal to the vector. I have a while loop that determines the values of "K" and just want to rerun the program 1000 times and save all "K" in the Matrix "C" as rows. This is what I am doing but looks like something is not as it is supposed be:
for ii=1:1000
while ....
K=...
end
C(ii,:)=K
end
5 个评论
Raphael Klapczynski
2018-2-22
编辑:Raphael Klapczynski
2018-2-22
It looks like a problem caused by K vector. The for loop works without any problems for me. Or you manipulate ii inside the while-loop.
for ii=1:4
K = rand([1 3]);
C(ii,:)=K
end
回答(0 个)
另请参阅
类别
在 Help Center 和 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!