How to reshape an M x (aN) matrix into a (aM) x (N) matrix in MATLAB?
1 次查看(过去 30 天)
显示 更早的评论
Hey everyone,
I want to reshape an M x (aN) matrix into a (aM) x (N) matrix in MATLAB without using nested for loops?
An example transformation is given below if a=3. (Each square is given with a size of M x N)
0 个评论
采纳的回答
Bruno Luong
2022-3-28
编辑:Bruno Luong
2022-3-28
Use permute
m = 3;
n = 2;
a = 4;
A = reshape(zeros(m,n)+reshape(1:a,[1 1 a]),[m n*a]);
A
B = reshape(permute(reshape(A,[m n a]),[1 3 2]),[m*a n])
更多回答(0 个)
另请参阅
类别
在 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!