0001 function ltpdv_filterAdd(varargin)
0002
0003
0004 myh = varargin{1};
0005 htab = varargin{end-1};
0006 mainfig = varargin{end};
0007
0008
0009 filts = getappdata(mainfig, 'Filters');
0010
0011
0012 filt = ltpdv_get_selected_filter(htab);
0013
0014
0015 count = 1;
0016 while true
0017 found = false;
0018 for j=1:length(filts)
0019 if strcmp(filt.name, filts(j).name)
0020 if count > 1
0021 filt.setName(sprintf('%s%02d', filt.name(1:end-2), count), 'internal');
0022 else
0023 filt.setName(sprintf('%s%02d', filt.name, count), 'internal');
0024 end
0025 found = true;
0026 count = count + 1;
0027 end
0028 end
0029 if ~found
0030 break;
0031 end
0032 end
0033
0034
0035 setappdata(mainfig, 'Filters', [filts filt]);
0036
0037
0038 ltpdv_set_filter_list(mainfig);