Replace the elements of a matrix
19 次查看(过去 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!