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.

采纳的回答

Bjorn Gustavsson
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 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by