From: sunram on
Hi ,

I have a large matrix of 5 columns. I have identified :

d = data(:,3);
w = data(:,5);

I would like to remove any row that has d = 0 AND w = 0 .

For example, I tried the following :

x = find(d == 0 & w ==0)

How would I now remove rows with x in it and display the removed rows?

Thank you in advance!
From: dpb on
sunram wrote:
> Hi ,
> I have a large matrix of 5 columns. I have identified :
>
> d = data(:,3);
> w = data(:,5);
>
> I would like to remove any row that has d = 0 AND w = 0 .
>
> For example, I tried the following :
> x = find(d == 0 & w ==0)
>
> How would I now remove rows with x in it and display the removed rows?

How about

y=x(~ismember([data(:,3) data(:,5)],[0 0],'rows'),:) % x w/o 0's id'ed
r=x(ismember([data(:,3) data(:,5)],[0 0],'rows'),:) % removed rows

--
From: dpb on
dpb wrote:
....

> y=x(~ismember([data(:,3) data(:,5)],[0 0],'rows'),:) % x w/o 0's id'ed
> r=x(ismember([data(:,3) data(:,5)],[0 0],'rows'),:) % removed rows

Check that...I was using "x" as the data array then switched to your
"data" in midstream...

y=data(~ismember([data(:,3) data(:,5)],[0 0],'rows'),:);
r=data( ismember([data(:,3) data(:,5)],[0 0],'rows'),:);

sorry 'bout that...

--