bugGNU Octave - Bugs: bug #48693, classdef subsref method is not...


bug #48693: classdef subsref method is not called with correct nargout value

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Wed 03 Aug 2016 10:02:56 PM UTC  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)

You are not logged in

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


Wed 03 Aug 2016 10:02:56 PM UTC, original submission:

In a classdef handle class, the subsref method is supposed to be called with `nargout` set to the number of values that the indexing argument addresses.

This works for old-style struct-based classes, but not for classdef classes.

Given the following constructor

and the following simple definition of subsref

Then the following only returns a single value, even though the indexing operation is over a range of 10 values, and nargout should be set accordingly to capture 10 values:

but, assigning to the right number of output values gets the correct output

If foo is changed to be a struct-based class with the following constructor, but the subsref method is left exactly the same,

then nargout is set correctly and the indexing examples work as expected.

This is a difference in how subsref is implemented in the octave_class vs octave_classdef classes.

Mike Miller <mtmiller>
Project Administrator


(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 mtmiller (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):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1