extracting diagonals from 3d matrices
Show older comments
I try to extract diagonals from 7*7*217 matrices into 1*7*217. How can i make it? I tried below code but it did't work. I would appreciate if you help me.
for k=1:217
D(:,:,k)=diag(diag(L(:,:,k)));
end
Answers (1)
Lr=reshape(L,1,49,[]);
D=Lr(1,1:8:end,:);
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!