matlab - 找到具有最低最大值的行/列

标签 matlab octave

考虑下面的矩阵:

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/

相关文章:

c - 如何在 MATLAB 中获取矩阵的指数?

python - 为什么我在 Python 中使用 BFGS 最小化没有得到与 MATLAB 中相同的结果?

matlab - 在 MATLAB 中使用 'fill' 函数时如何更改边线颜色?

arrays - 具有 max(abs(x),abs(y)) 的元素 x(i) 或 y(i) 的 MATLAB 向量

matlab - 以特定格式加载 Octave 中的文本数据

c++ - Matlab引擎API的线程安全

octave - 错误: tf' function belongs to the control package from Octave Forge which you have installed but not loaded

octave - 为什么 Octave 在我的文件中插入这个奇怪的字符?

python - 使用Python + Octave进行音频分析