How to find index in multi-dimension matrix
2 次查看(过去 30 天)
显示 更早的评论
Say I have a matrix of m x n x l x w (4-D). How may I find the max/min and the corresponding index in 4-D?
I appreciate your help.
0 个评论
采纳的回答
Bjorn Gustavsson
2021-11-26
You can do this in 2 simple steps:
[xMax,idx1D] = max(X(:));
[i1,i2,i3,i4] = ind2sub(size(X),idx1D);
HTH
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!