How to append vector in a for loop

19 次查看(过去 30 天)
Hi there,
I have a for loop that creates an 10x10 vector in each iteration. My question is how can I append each 10x10 vector underneath each other after each iteration. So that the final vector is 30x10.
Thank you for your time
for i=1:3
% Do stuff
%result is 10x10 vector A
end

采纳的回答

Wayne King
Wayne King 2014-1-7
编辑:Wayne King 2014-1-7
B = [];
for ii=1:3
A = randi(10,10); % this is the code to create the 10x10
B = [B ; A];
end
  3 个评论
madhan ravi
madhan ravi 2018-10-13
Ask a separate question @Samuel

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by