function thelist=setList(thelist,name,object) %setList - set a named object in a list to a new value (object). % % Parameter: thelist The list to be searched % Parameter: name Name to search for % Parameter: object the new value % Returns: thelist The modified list % % Example(s): % % %% Fix deeper HAM band notches % hb = getList(ex.tfplist, ex.param.HAMBandName); % hb.PSD.downstream = strrep(hb.PSD.downstream,'-80','-140'); % hb.PSD.upstream = strrep(hb.PSD.upstream, '-80','-140'); % ex.tfplist = setList(ex.tfplist,hb.name,hb); % %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 by Telia Research AB, Lulea, Sweden; % 2000-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Bo Engstrom (bosse@upzide.com) % % CVS: $Id: setList.m 752 2009-01-02 13:03:52Z tono $ %% =========================================================================== % Change History % 1999-02-25 (ToNo) Created % 2001-06-15 (Bosse) Octave port % 2002-07-01 (PeKa) Octave to Matlab compatibility port % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab %% =========================================================================== len = length(thelist); found=0; for i=1:len, y=thelist{i}; if strcmp(y.name, name) if iscell(thelist(i)) thelist{i}=object; else thelist(i)=object; end found=1; break; end end % Check if we found anything if ~found estr=sprintf('Warning in setList: object %s not found', name); disp(estr); end