From: Li on
I am working on a set of data with millions of rows. So I have to find the fastest way to process it. Now I just want to remove the rows, if the vector (the first column) in that row is equal to zero. I used the below code, and it took almost an hour to finish. Is there a quicker way to do this? Thanks!

Ind = [];
for i = 1:m;
if A(i, 1) == 0 ;
Ind = [Ind; i];
end;
end;
A (Ind, :) = [];
From: XYZ on
On 25.03.2010 21:29, Li wrote:
> I am working on a set of data with millions of rows. So I have to find
> the fastest way to process it. Now I just want to remove the rows, if
> the vector (the first column) in that row is equal to zero. I used the
> below code, and it took almost an hour to finish. Is there a quicker way
> to do this? Thanks!
>
> Ind = [];
> for i = 1:m; if A(i, 1) == 0 ;
> Ind = [Ind; i];
> end;
> end;
> A (Ind, :) = [];

A = A(find(A(:,1)),:)