bugGNU Octave - Bugs: bug #36236, Boolean indexing not too prominent...


bug #36236: Boolean indexing not too prominent in the docs.

Submitted by:  None
Submitted on:  Wed 18 Apr 2012 07:21:10 AM UTC  
Category: DocumentationSeverity: 2 - Minor
Priority: 3 - LowItem Group: Documentation
Status: ConfirmedAssigned to: Jordi Gutiérrez Hermoso <jordigh>
Originator Name: Alexander KleinOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 19 Nov 2016 09:38:14 PM UTC, comment #5:

This documentation wish hasn't become better in Octave 4.2.0, yet.

Hartmut <hardy>
Thu 04 Jun 2015 01:09:59 AM UTC, comment #4:

Revisiting this old dormant bug.

Re comment #3, the main question is why does a logical index array with out-of-range true values return an error but there is no error when all out-of-range values are false:


I don't have an answer, just asking if that is the only thing blocking a documentation patch to resolve this bug report?

Mike Miller <mtmiller>
Project Administrator
Mon 04 Jun 2012 06:59:20 AM UTC, comment #3:


I just found some time to fix the documentation concerning boolean indexing, and wondered if the following is intended behaviour:

octave:44> a=rand(5)
a =

0.590252 0.785107 0.789109 0.973847 0.037473
0.720128 0.552948 0.529387 0.712228 0.285633
0.097387 0.498243 0.368774 0.341973 0.272160
0.302804 0.645076 0.383922 0.550020 0.883258
0.181661 0.969068 0.376169 0.458497 0.294898

octave:45> b=a(1:3,1:3)>0.5
b =

1 1 1
1 1 1
0 0 0

octave:46> a(b)
ans =


octave:47> a(1:rows(b),1:columns(b))(b)
ans =


octave:48> a(rand(7)>0.5)
error: A(I): index out of bounds; value 48 out of bound 25
octave:48> a(-rand(7)>0.5)
ans = [](0x1)

So, what we get in more than one dimension is vec(<array>)(find(vec(<boolean>))), which is OK, and seems to be the only way to go for equally sized arrays and boolean indices, but we get index errors only for out of bounds true indices, and puzzling results without a warning when the indexing array is smaller than the indexed array.

Is this really what we want?


Alexander Klein <matalex>
Wed 09 May 2012 07:20:46 AM UTC, comment #2:

Why not, but probably not until next week.

Alexander Klein <matalex>
Wed 09 May 2012 03:46:35 AM UTC, comment #1:

Yes, I agree that logical indexing really needs to be more prominent. And with more examples.

Can you suggest how to do this? I mean, actually write the modifications to the manual? Don't worry if you can't do it in TeXinfo. I can fix that up, but if you could contribute the actual prose to write and where to insert it, that would be very useful.

Jordi Gutiérrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Wed 18 Apr 2012 07:21:10 AM UTC, original submission:

I was just browsing the manual, and I noticed that 'boolean indexing' seems to be mentioned exactly once, namely in the section about 'Basic vectorization'.

The section about index expressions, however, states that "Indices may be scalars, vectors, ranges, or the special operator ‘:’, which may be used to select entire rows or columns."

I think boolean indexing should be made more prominent, since although I've been using Octave for nearly a decade, boolean indexing managed to escape my notice until only a few weeks ago.





(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by matalex (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 04 Jun 2015 01:09:59 AM UTCmtmillerSeverity3 - Normal=>2 - Minor
      Priority5 - Normal=>3 - Low
    Tue 29 Oct 2013 03:48:40 AM UTCmtmillerCategoryNone=>Documentation
    Wed 09 May 2012 03:46:35 AM UTCjordighStatusNone=>Confirmed
      Assigned toNone=>jordigh

    Back to the top

    Powered by Savane 3.1-cleanup1