mrlonely2018

寻找二维矩阵accumA的最大值所在位置的索引:

[MA,IA]=max(accumA); % max value of each column & row index of each column
[mVal,mInd]=max(MA); % max value of matrix & column index of that value
maxRow=IA(mInd);
maxCol=mInd;

  maxRow为第一个维度的索引,maxCol为第二个维度的索引。

##find the index of the maximum value in a 2D or 3D matrix in MATLAB##

寻找三维矩阵的最大值所在位置的索引:

[M,I]=max(A);
M=squeeze(M);
I=squeeze(I);
[M_,I_]=max(M);
[M__,I__]=max(M_);

maxR=I__;
maxCol=I_(maxR);
maxRow=I(maxCol,maxR);

  maxR为第三个维度的索引,maxCol为第二个维度的索引,maxRow为第一个维度的索引。

分类:

技术点:

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-07-20
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
猜你喜欢
  • 2022-03-08
  • 2021-12-27
  • 2021-05-27
  • 2021-11-04
相关资源
相似解决方案