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$>
References: <ib0jl3$6es$> <ib0lbg$p9c$> <ib0vne$6lh$> <ib11rk$k4p$> <ib139n$3bh$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1288967644 5213 (5 Nov 2010 14:34:04 GMT)
NNTP-Posting-Date: Fri, 5 Nov 2010 14:34:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 415894
Xref: 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.