annotate _FullBNT/BNT/@assocarray/subsref.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function val = subsref(A, S)
matthiasm@8 2 % SUBSREF Subscript reference for an associative array
matthiasm@8 3 % A('foo') will return the value associated with foo.
matthiasm@8 4 % If there are multiple identicaly keys, the first match is returned.
matthiasm@8 5 % Currently the search is sequential.
matthiasm@8 6
matthiasm@8 7 i = 1;
matthiasm@8 8 while i <= length(A.keys)
matthiasm@8 9 if strcmp(S.subs{1}, A.keys{i})
matthiasm@8 10 val = A.vals{i};
matthiasm@8 11 return;
matthiasm@8 12 end
matthiasm@8 13 i = i + 1;
matthiasm@8 14 end
matthiasm@8 15 error(['can''t find ' S.subs{1}])