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): % tfplan = getList(ex.list,'Zipper'); % tfplan.PBOmethod='rl'; % tfplan.PBOparam=1500; % ex.list=setList(ex.list,'Zipper',tfplan); % %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 by Telia Research AB, Lulea, Sweden; % 2000-2003 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,v 3.2 2003/11/03 12:33:22 tono Exp $ %% =========================================================================== % 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('Varning in setList: object %s not found', name); disp(estr); end