Path: news.mathworks.com!newsfeed-00.mathworks.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeds.phibee-telecom.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail
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: Aioe.org NNTP Server
Lines: 24
Message-ID: <k0e3ih$gvs$1@speranza.aioe.org>
References: <hs1pti$hmk$1@fred.mathworks.com> <hs1qg9$psa$1@fred.mathworks.com> <k0doda$cqf$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: soOUTtsPBOBMsFHvslRIpg.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com 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...

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

--