Clip - Clip values. Clip values between specified extrema. USAGE clipped = Clip(x,min,max) x array to clip min minimum value max maximum value
0001 function x = Clip(x,m,M) 0002 0003 %Clip - Clip values. 0004 % 0005 % Clip values between specified extrema. 0006 % 0007 % USAGE 0008 % 0009 % clipped = Clip(x,min,max) 0010 % 0011 % x array to clip 0012 % min minimum value 0013 % max maximum value 0014 0015 % Copyright (C) 2004-2011 by Michaƫl Zugaro 0016 % 0017 % This program is free software; you can redistribute it and/or modify 0018 % it under the terms of the GNU General Public License as published by 0019 % the Free Software Foundation; either version 3 of the License, or 0020 % (at your option) any later version. 0021 0022 if nargin < 3, 0023 error('Incorrect number of parameters (type ''help <a href="matlab:help Clip">Clip</a>'' for details).'); 0024 end 0025 0026 x(x<m) = m; 0027 x(x>M) = M;