From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Removing rows containing all zeros in a matrix
Date: Tue, 14 Aug 2012 12:57:33 -0500
Organization: NNTP Server
Lines: 24
Message-ID: <k0e3ih$gvs$>
References: <hs1pti$hmk$> <hs1qg9$psa$> <k0doda$cqf$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: comp.soft-sys.matlab:776466

On 8/14/2012 9:47 AM, Kwen wrote:

>> > ... I want to remove the rows that contain all 0's. ...

>> one of the solutions

>> m(all(m==0,2),:)=[]

> This works for the method I'm trying to use, but I also want to index
> where those zeros were in order to adjust the corresponding 'x' and
> interpolate to create a new data set. How would I go about doing so?

Just use the same logic vector on the corollary arrays as well...

m(idx,:)= [];   % remove same rows from m and x...
x(idx,:)= [];   % remove same rows from m and x...