考虑下面的矩阵:
A = randi([0 100], 5, 7)
62 59 20 42 49 41 83 37 34 13 65 82 47 24 93 33 19 93 30 37 20 42 49 74 96 26 41 21 14 85 14 90 77 4 96
first I want to find the maxima of each row and the column index:
83 7 82 5 93 1 96 4 96 7
then I need to find the row with the lowest maxima:
82 5 2
so far, I have implemented this:
close all;
clear all;
clc;
A = randi([0 100], 5, 7);
[M1, I1] = max(A, [], 2);
[M1, I1]
[M2, I2] = min(M1);
[M2, I1(I2), I2]
虽然这感觉像是一种解决方法,但我想知道是否有更规范的方法来做到这一点?也许是用于此特定目的的内置函数或 min
/max
语法?
P.S. 也在 MATLAB Discord channel 上分享了这个问题.
最佳答案
find
怎么样?
M = min(max(A,[],2));
[i,j] = find(A == M);
[M,j,i]
关于matlab - 找到具有最低最大值的行/列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66470501/