0001 function tpl = loadtpl(tpl,handle)
0002
0003
0004
0005
0006
0007
0008
0009 if ~isempty(get(tpl,'var',handle))
0010 return;
0011 else
0012 ind = find(ismember(tpl.handles,handle));
0013 if isempty(ind)
0014 error('[Template] No such template handle.');
0015 else
0016 filename = tpl.file{ind};
0017 [fid, errmsg] = fopen(filename,'rt');
0018 if ~isempty(errmsg)
0019 error(sprintf('Cannot open template file %s.',filename));
0020 end
0021 tpl = set(tpl,'var',handle,fscanf(fid,'%c'));
0022 fclose(fid);
0023 end
0024 end