Rearrange matrix into single row
조회 수: 10 (최근 30일)
이전 댓글 표시
Hey there, I have a matrix that looks like this
b=1 2 3 4
1 2 3 4
1 2 3 4
What do I have to do to arrange it into a single row vector[ 1 2 3 4 1 2 3 4 1 2 3 4]?
댓글 수: 0
채택된 답변
Paul Shoemaker
2018년 8월 10일
reshape(b',1,numel(b)) % Note the transpose ('), this is important.
댓글 수: 1
Stephen23
2018년 8월 10일
편집: Stephen23
2018년 8월 10일
This answer uses complex transpose. See James Tursa's answer for the correct solution for all cases.
추가 답변 (1개)
James Tursa
2018년 8월 10일
편집: James Tursa
2018년 8월 10일
result = reshape(b.',1,[]);
The transpose is needed to get the row values to line up in memory first before doing the reshape.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!