Daniel@0: function val = subsref(A, S) Daniel@0: % SUBSREF Subscript reference for an associative array Daniel@0: % A('foo') will return the value associated with foo. Daniel@0: % If there are multiple identicaly keys, the first match is returned. Daniel@0: % Currently the search is sequential. Daniel@0: Daniel@0: i = 1; Daniel@0: while i <= length(A.keys) Daniel@0: if strcmp(S.subs{1}, A.keys{i}) Daniel@0: val = A.vals{i}; Daniel@0: return; Daniel@0: end Daniel@0: i = i + 1; Daniel@0: end Daniel@0: error(['can''t find ' S.subs{1}])