Remove a row based on its value

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)

 Risposta accettata

X = [1:10]'
Y = [1:10]'
H = [1, 0, 0 , 0, 2, 3, 4, 0 , 0, 4]'
Location = [X,Y,H];
Location(Location(:,3)<1,:)=[];

Più risposte (0)

Categorie

Prodotti

Release

R2021b

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by