MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > logical indexing with larger logical array 

Subject: logical indexing with larger logical array From: Bruno Luong Date: 5 Nov, 2010 09:44:04 Message: 1 of 13 
>> a = [1 2 3]; 
Subject: logical indexing with larger logical array From: Roger Jones Date: 5 Nov, 2010 10:13:04 Message: 2 of 13 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ib0jl3$6es$1@fred.mathworks.com>... 
Subject: logical indexing with larger logical array From: David Young Date: 5 Nov, 2010 13:10:06 Message: 3 of 13 
"Roger Jones" <leave@mealone.com> wrote 
Subject: logical indexing with larger logical array From: Steven_Lord Date: 5 Nov, 2010 13:31:39 Message: 4 of 13 

Subject: logical indexing with larger logical array From: dpb Date: 5 Nov, 2010 13:41:49 Message: 5 of 13 
David Young wrote: 
Subject: logical indexing with larger logical array From: David Young Date: 5 Nov, 2010 14:11:03 Message: 6 of 13 
Steven and dbp: thanks. Actually, I understood the reason for the 2D behaviour (that a(I) is the same as a(I(:))). 
Subject: logical indexing with larger logical array From: David Young Date: 5 Nov, 2010 14:34:04 Message: 7 of 13 
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: 
Subject: logical indexing with larger logical array From: Bruno Luong Date: 5 Nov, 2010 14:38:03 Message: 8 of 13 
To me it looks like the logical indexing engine performs the bound checking with *every* elements that corresponds to TRUE. That's why it issues an error with outside TRUE and not outside FALSE. If the checking is performed once before the scan on the sizes of the array and the logical array, there might be some speed gain. 
Subject: logical indexing with larger logical array From: dpb Date: 5 Nov, 2010 16:06:13 Message: 9 of 13 
Bruno Luong wrote: 
Subject: logical indexing with larger logical array From: Jan Simon Date: 5 Nov, 2010 16:26:04 Message: 10 of 13 
Dear Bruno, 
Subject: logical indexing with larger logical array From: Jan Simon Date: 6 Nov, 2010 10:47:03 Message: 11 of 13 
Dear Readers, 
Subject: logical indexing with larger logical array From: Bruno Luong Date: 6 Nov, 2010 12:18:03 Message: 12 of 13 
"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <ib3bn7$5r2$1@fred.mathworks.com>... 
Subject: logical indexing with larger logical array From: Jan Simon Date: 6 Nov, 2010 12:59:04 Message: 13 of 13 
Dear Bruno, 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.