Why there are “too many output arguments” when defining MATLAB containers. Swap subclass method with 0 pins?

I am trying to extend the MATLAB container class. The class subclasses it and adds an additional method with 0 outputs, but when I execute the method, I encounter the error "too many output arguments". This does not apply to the new implementation of the method - any additional method that extends .Map () containers with 0 pins generates this error.

In particular, an error occurs during execution,

obj = Containers();
obj.testfun();

For the following class definition

classdef Containers < handle & containers.Map
    methods       
        % Test function to display keys.
        function testfun(obj)
            obj.keys(); % dumby thing to execute with incoming object.
            disp('it works!');
        end
    end
end

However, if we slightly modify it to output at least one argument,

classdef Containers < handle & containers.Map
    methods       
        % Test function to display keys.
        function dumby = testfun(obj)
            obj.keys();
            disp('it works!')
            dumby = 1;
        end
    end
end

. , . . , MATLAB R2014b. ?

+4
1

containers.Map. , MathWorks Sealed, .

, a.b a(b) a{b}, subsref. . . doc subsref , MATLAB subsref, - .

, , subsref, . containers.Map , , MATLAB.

, subsref containers.Map, , . , - , , - , .testfun() testfun testfun testfun > - , , , - , .

, , (, , ) , MathWorks Sealed, , , , (.. subsref Containers, , ) (.. subsref containers.Map).

, containers.Map (, ) , , containers.Map. , .

+1

All Articles