function p = scaleParameter(p, sf)
%SCALEPARAMETER Scales parameter (array) by a given scaling factor.
%
% Scaling factor may be a scalar or a matrix of size equal to that of
% p.Value.

%   Author(s): Rajiv Singh
%   Copyright 2011 The MathWorks, Inc.

for ct = 1:numel(p)
   pct = p(ct);
   pct.Value = pct.Value.*sf;
   Min = pct.Minimum;
   Max = pct.Maximum;
   if any(any(~isinf(Min) & Min~=0))
      pct.Minimum = pct.Minimum.*sf;
   end
   if any(any(~isinf(Max) & Max~=0))
      pct.Maximum = pct.Maximum.*sf;
   end
   pct.Scale = pct.Scale.*sf;
   p(ct) = pct;
end
