Create an array from others matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
I need to put "a" matrix one below the other in a single matrix. That is, I need to place in a matrix of dimension a*b x N, where the first b rows correspond to sec=1, from row b+1 to row 2b+1 the second matrix corresponding to sec=2, and so on.
For example for this code:
a=100;
b=5;
N=8;
for sec=1:a
PM=rand(b,N)
end
I want to create the matrix of dimension 500x8, formed by the 100 matrix generated, where the first 5 rows correspond to the matrix obtained for sec = 1, from row 6 to row 11 the second matrix corresponding to the matrix obtained for sec = 2, and so on.
댓글 수: 3
Bob Thompson
2019년 10월 14일
Ok, well the indexing on 'data' should be what you're looking for. I can't write the right hand side of the equation for you because I don't know what it looks like.
채택된 답변
Fabio Freschi
2019년 10월 14일
You can just append the matrices as they come.
a=100;
b=5;
N=8;
% inital empty matrix
PM = [];
% your loop
for sec=1:a
PM = [PM; rand(b,N)];
end
댓글 수: 6
Fabio Freschi
2019년 10월 14일
My pleasure! If my answer solve your original problem, please accept it!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!