Effacer les filtres
Effacer les filtres

[~,i]=max(y); what does it mean in matlab

33 vues (au cours des 30 derniers jours)
Ramya R
Ramya R le 15 Fév 2019
Modifié(e) : Mark Sherstan le 15 Fév 2019
can i know the meaning of this command "[~,i]=max(y);" in matlab??

Réponses (1)

Mark Sherstan
Mark Sherstan le 15 Fév 2019
Modifié(e) : Mark Sherstan le 15 Fév 2019
Your answer can be found here, I copied and pasted it below for your convience:
The ~ represents an output that is discarded. It is essentially equivalent to:
[dummy,idx]=min(dists);
clear dummy
For this example, the code wants to work with the index of the minimum value, not the value itself, so the minimum value that is returned is discarded and only the index is retained.

Catégories

En savoir plus sur Data Types 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