function P = changeParName(P, NewName)
% Change name of parameter object (array).
% Use a new name:
%     P = pmodel.changeParName(P, NewName);

%   Copyright 2010 The MathWorks, Inc.

Warn = ctrlMsgUtils.SuspendWarnings('Controllib:modelpack:warnChangeParameterName'); %#ok<NASGU>
for ct = 1:numel(P)
   if ~strcmp(P(ct).Name, NewName)
      P(ct) = changeName(P(ct),NewName);
   end
end
