From: Walter Roberson <>
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv: Gecko/20100802 Thunderbird/3.1.2
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Speeding up removal of zero columns
References: <i5ecr3$bof$> <i5egj6$8tb$>
In-Reply-To: <i5egj6$8tb$>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 10
Message-ID: <vmAeo.2095$rC7.209@newsfe10.iad>
X-Trace: newsfe10.iad 1283117595 (Sun, 29 Aug 2010 21:33:15 UTC)
NNTP-Posting-Date: Sun, 29 Aug 2010 21:33:15 UTC
Date: Sun, 29 Aug 2010 16:33:14 -0500
Xref: comp.soft-sys.matlab:665977

On 29/08/10 3:40 PM, Roger Stafford wrote:
> "Kurt " <> wrote in message
> <i5ecr3$bof$>...

>> routes2=routes2(:,any(routes2));

> As your code is now, every element of every column must be tested.

No, any() and all both short-circuit; this can be demonstrated with some 
simple timing tests on larger arrays.