Effacer les filtres
Effacer les filtres

Special selecting rows of a matrix

1 vue (au cours des 30 derniers jours)
mr mo
mr mo le 18 Déc 2017
Commenté : mr mo le 19 Déc 2017
Hi. I have a matrix of size m*n.
I want to select those rows of this matrix that their value in 10th column are between 10 to 12.
How can I do that?
Thanks a lot.

Réponse acceptée

Roger Stafford
Roger Stafford le 18 Déc 2017
Modifié(e) : Roger Stafford le 18 Déc 2017
Let M be the given matrix. Then do this:
p = (1:size(M,1)).';
p = p(M(:,10)<=12&M(:,10)>=10);
p will be a column vector consisting of the row indices of all rows in M in which the element of the 10th column lies between 10 and 12.
  1 commentaire
mr mo
mr mo le 19 Déc 2017
Thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays 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