Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 5x5 矩阵
A B C D E 1 5 7 2 3 2 1 9 8 5 3 1 2 3 1 4 1 3 4 2 5 2 9 0 1
我需要找到B(这将是5)的最大值及其对应的值A(这将是1),我该怎么做?
B
A
max 实际上同时返回 vlaue 和它的位置。如果 M 是您的 5x5 矩阵:
[mb,i] = max(M(:,2)); ma = M(i,1);
应该做的伎俩。
如果 mb 与你无关,
[~,i] = max(M(:,2)); ma = M(i,1);
将丢弃 max 的返回值