Effacer les filtres
Effacer les filtres

how to exclude a row based on a column value?

5 vues (au cours des 30 derniers jours)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD le 13 Fév 2018
Commenté : Star Strider le 13 Fév 2018
Dear All, I have a matrix called M, composed of 15 columns and 100000 rows, the third column supposed to be the month so the values in it must be from 1 to 12, how can i check if there is a value out of this range in this column, for example 13 or 0 or any thing not between 1 and 12? and after that delete the row that carries this error number?

Réponse acceptée

Star Strider
Star Strider le 13 Fév 2018
Try this:
M_edited = M((M(:,3)>=1) & (M(:,3)<=12), :);
It assigns only the rows in ‘M’ with months from 1 to 12 in ‘M_edited’. The others are not copied to it.
  8 commentaires
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD le 13 Fév 2018
I DID IT, THANKS
Star Strider
Star Strider le 13 Fév 2018
As always, my pleasure!
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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