From: sunram on 21 Jun 2010 06:52 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 21 Jun 2010 06:59 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 21 Jun 2010 11:28 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... --
|
Pages: 1 Prev: add new legend content and meaning of the object_handle Next: matlab crashes on opening help |