Remove a row based on its value
Afficher commentaires plus anciens
Hello, I want to remove any rows where there is a 0 in column H.
For example if I have a row:
X Y H
[1, 1, 0]
I want to delete this row completly.
This is the code I have so far, but all it does is transpose the my three columns into one row matrix, and does not delete any rows.
X = [1:10]'
Y = [1:10]'
H = [1, 0, 0 , 0, 2, 3, 4, 0 , 0, 4]'
Location = [X,Y,H]
Remove = find(Location(:,3)<1);
Location(Remove)=[];
Does any one have any ideas what I am doing wrong?
(The X,Y,H values are random matrices I have added for context, my real data set is a lot larger)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!