A = magic(5); % 例如一个5x5的魔方矩阵
[maxValue, linearIndex] = max(A(:));
[rowIndex, colIndex] = ind2sub(size(A), linearIndex);
Matlab代码 图像处理 线性索引转行列索引
于 2023-12-02 01:37:37 首次发布
A = magic(5); % 例如一个5x5的魔方矩阵
[maxValue, linearIndex] = max(A(:));
[rowIndex, colIndex] = ind2sub(size(A), linearIndex);