Home > rest_20090422 > rest_spm5_files > @read_nifti > private > findindict.m

findindict

PURPOSE ^

Look up an entry in the dictionary

SYNOPSIS ^

function entry = findindict(c,dcode)

DESCRIPTION ^

 Look up an entry in the dictionary
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

findindict.m

SOURCE CODE ^

0001 function entry = findindict(c,dcode)
0002 % Look up an entry in the dictionary
0003 % _______________________________________________________________________
0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0005 
0006 %
0007 % $Id: findindict.m 253 2005-10-13 15:31:34Z guillaume $
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     %fprintf('\nNO CHANGES MADE\n');
0036 end;
0037

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005