0001 function LATTICE = settags(LATTICE,INDEX,tag,varargin)
0002
0003
0004
0005
0006
0007
0008
0009 if ischar(INDEX)
0010 INDEX = findcells(LATTICE,'FamName',INDEX);
0011 if isempty(INDEX)
0012 error(['Family ''',fname,''' is not found']);
0013 end
0014 end
0015
0016 tag = reshape(cellstr(tag),1,[]);
0017
0018 if nargin <=3
0019 for i = INDEX
0020 LATTICE{i}.Tag = tag;
0021 end
0022 elseif strcmpi(varargin{1},'append')
0023 for i = INDEX
0024 if isfield(LATTICE{i},'Tag')
0025 LATTICE{i}.Tag = reshape(cellstr(LATTICE{i}.Tag),1,[]);
0026 LATTICE{i}.Tag = union(LATTICE{i}.Tag, tag);
0027 else
0028 LATTICE{i}.Tag = tag;
0029 end
0030
0031 end
0032 end