0001 function entry = findindict(c,dcode)
0002
0003
0004
0005
0006
0007
0008
0009
0010 entry = [];
0011 d = getdict;
0012 d = d.(dcode);
0013 if ischar(c)
0014 for i=1:length(d),
0015 if strcmpi(d(i).label,c),
0016 entry = d(i);
0017 break;
0018 end;
0019 end;
0020 elseif isnumeric(c) && numel(c)==1
0021 for i=1:length(d),
0022 if d(i).code==c,
0023 entry = d(i);
0024 break;
0025 end;
0026 end;
0027 else
0028 error(['Inappropriate code for ' dcode '.']);
0029 end;
0030 if isempty(entry)
0031 fprintf('\nThis is not an option. Try one of these:\n');
0032 for i=1:length(d)
0033 fprintf('%5d) %s\n', d(i).code, d(i).label);
0034 end;
0035
0036 end;
0037