Matlab using multiple containers.Map raises an Index exceeds matrix dimensions error -


here sample code:

class a:

classdef classa     properties         mapofb     end     methods         function self = classa(names)             self.mapofb = containers.map();             = 1:numel(names)                 self.mapofb(names{i}) = classb(names);             end         end     end end 

class b:

classdef classb     properties         maptest     end     methods         function self = classb(names)              self.maptest = containers.map();             = 1:numel(names)                 self.maptest(names{i}) = rand(1,3);             end         end                   end    end 

main script:

names = {'one', 'two', 'three', 'four'}; = classa(names); a.mapofb a.mapofb.keys a.mapofb('one') a.mapofb('one').maptest a.mapofb('one').maptest.keys a.mapofb('one').maptest('one') 

console output:

a.mapofb('one').maptest.keys  ans =       'four'    'one'    'three'    'two'  a.mapofb('one').maptest('one') error using subsref index exceeds matrix dimensions. 

i don't understand why there index exceeds matrix dimensions error when call map item in map. matlab limitation ?

this line, totally equivalent "a.mapofb('one').maptest('one')", not raise error

builtin('_paren', a.mapofb('one').maptest, 'one') 

therefore it's not "real" error, limitation on matlab's syntax or implementation of containers.map's subsref() operator.

see this popular question


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -