How do I select elements out of a matrix with a loop?
1 次查看(过去 30 天)
显示 更早的评论
Hi, please help. I have a 16x16 matrix where I need to pick a 16 elements out for a 4x4 matrix. (Guyan reduction) I don't know how to make loops jet. /Klara
0 个评论
回答(1 个)
David Sanchez
2013-9-25
You can try the following:
A = rand(16); % a 16x16 random matrix
B = reshape(M,4,4,16); % you will get 16 4x4 matrices. To access these matrices:
for k=1:16
B(:,:,k);
end
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!