How can I find the maximum of a given matrix and then locate the minimum value along the row of the maximum value
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bashir Yusuf Bichi
le 14 Nov 2017
Commenté : Vinay
le 15 Juil 2023
e.g a =
4 2 8
5 9 1
3 10 17
maximum will be 17 for the entire array and 3 will be the min value along the row of 17.
0 commentaires
Réponse acceptée
Andrei Bobrov
le 14 Nov 2017
Modifié(e) : Andrei Bobrov
le 14 Nov 2017
[v_max,jj] = max(max(a,[],2));
out_min = min(a(jj,:));
or
[ii,~] = find(max(a(:))==a);
out = min(a(ii,:));
2 commentaires
Plus de réponses (1)
mounika
le 14 Nov 2017
x=[4 2 8;5 9 1;3 10 17];
[M,I] = max(x(:)); % find maximum element in the entire matrix
[I_row, I_col] = ind2sub(size(x),I);% convert matrix position to matrix indices
x_min = x(I_row,:); % extract the row containing maximum value
x_min = min(x_min); % minimum of that row
0 commentaires
Voir également
Catégories
En savoir plus sur Elementary Math dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!