Replace the elements of a matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I have an A matrix as
A=[a b ; c d ; e f ; g h]
and want to get B matrix as
B=[a ; b; c; d; e; f; g; h]
using A matrix. How can I code it? Thanks
댓글 수: 0
채택된 답변
per isakson
2019년 6월 9일
편집: per isakson
2019년 6월 9일
One way
z = permute( A, [2,1] );
B = z(:);
or
z = permute( A, [2,1] );
B = reshape( z, [],1 );
추가 답변 (2개)
TADA
2019년 6월 9일
B = reshape(A',numel(A),1)
댓글 수: 1
Walter Roberson
2019년 6월 9일
A' is only correct for real valued entries, as it is the conjugate transpose.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!