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