Delete Rows with a specific condition

I have a matrix and I want to delete all rows that have ZEROS from columns 3 to end. How do?

 Réponse acceptée

dpb
dpb le 2 Oct 2013
Modifié(e) : dpb le 2 Oct 2013
x(~any(x(:,3:end),2),:)=[];

Plus de réponses (1)

Andrei Bobrov
Andrei Bobrov le 2 Oct 2013
Modifié(e) : Andrei Bobrov le 2 Oct 2013
out = x(all(x(:,3:end),2),:);

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by