Effacer les filtres
Effacer les filtres

How to define minimum value matrix?

1 vue (au cours des 30 derniers jours)
anil hamzacebi
anil hamzacebi le 8 Déc 2020
Commenté : anil hamzacebi le 8 Déc 2020
Hello everyone, i have a 4x4 matrix and i can find the minimum values of each row.
A=[1,2,4,3; 4,3,7,13; 8,7,9,11; 16,14,2,7];
B=min(A, [], 2)
B =
1
3
7
2
But i need to create a matrix that gives me the columns chosen for minimum values. For example, for the A matrix this is;
C=[1,2,2,3];
I hope you understand the problem, and can help me. Thank you!!!
  1 commentaire
dpb
dpb le 8 Déc 2020
Read the doc for min carefully looking for what options you're not using...

Connectez-vous pour commenter.

Réponse acceptée

David Hill
David Hill le 8 Déc 2020
[~,idx]=min(A,[],2);
  1 commentaire
anil hamzacebi
anil hamzacebi le 8 Déc 2020
this really works, Thank you so much!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical 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!

Translated by