How can I concatenate a row vertically every 5 cells?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
if A is an array 1 x 100, how can I turn it into an array of 10x10 or 20 x 5?
Thanks
채택된 답변
ANKUR KUMAR
2021년 3월 12일
편집: ANKUR KUMAR
2021년 3월 12일
You can use reshape command to do that.
A=randi(20,1,100);
reshape(A,20,5);
reshape(A,20,5);
It reshapes along the column of the matrix. This below example clarifies your concept:
A = 1:10;
B = reshape(A,[5,2])
B =
1 6
2 7
3 8
4 9
5 10
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!