Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: logical indexing with larger logical array
Date: Fri, 5 Nov 2010 14:34:04 +0000 (UTC)
Organization: Univ of Sussex
Lines: 5
Message-ID: <ib14ks$52t$1@fred.mathworks.com>
References: <ib0jl3$6es$1@fred.mathworks.com> <ib0lbg$p9c$1@fred.mathworks.com> <ib0vne$6lh$1@fred.mathworks.com> <ib11rk$k4p$1@news.eternal-september.org> <ib139n$3bh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1288967644 5213 172.30.248.35 (5 Nov 2010 14:34:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Nov 2010 14:34:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 415894
Xref: news.mathworks.com comp.soft-sys.matlab:684172

Just thought it would be worth noting what the documentation says on the topic. From Helpwin > MATLAB > User's Guide > Mathematics > Matrices and Arrays > Matrix Indexing > Using Logicals in Array Indexing:

"In most cases, the logical indexing array should have the same number of elements as the array being indexed into, but this is not a requirement. The indexing array may have smaller (but not larger) dimensions"

There is then an example which shows that in a(I), if I is smaller than a, then I(:) is padded with logical zeros.