Replacing whole row with NaN's if first value is equal to 13 or 15.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi! I have a matrix in which I want to replace the whole row with NaNs if the value of the first row is equal to 13 of 15. Can anyone help me with this?
0 commentaires
Réponse acceptée
Voss
le 19 Juin 2022
Do you mean the value of the first column is equal to 13 or 15?
A = randi(20,10,5)
idx = A(:,1) == 13 | A(:,1) == 15;
A(idx,:) = NaN
Or do you mean replace the whole column if the value of the first row is 13 or 15?
A = randi(20,10,5)
idx = A(1,:) == 13 | A(1,:) == 15;
A(:,idx) = NaN
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur NaNs 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!