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.
|