How to append vector in a for loop

조회 수: 8 (최근 30일)
John
John 2014년 1월 7일
댓글: Raymond MacNeil 2018년 10월 27일
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
Raymond MacNeil
Raymond MacNeil 2018년 10월 27일
Very helpful. Many thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (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