How to Delete Diagonal Elements from a Matrix and Reshape It?
12 次查看(过去 30 天)
显示 更早的评论
Hi all,
I have a matrix M that I would like to remove diagonal entries from and reshape it. For reference, all diagonal elements that I want to remove are 1s and the dimensions of this matrix are N x N (where N can be as large as 90) so I will give an smaller example below:
For some of my data, however, the diagonal entries are occasionally NaN. The diagonal entires thus, will either be 1 or NaN.
Thanks
M = [ 1 4 2 3
5 1 2 3
3 3 NaN 3
4 5 3 1 ]
% Ideal New Matrix after
M2 = [ 5 4 2 3
3 3 2 3
4 5 3 3 ]
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!