Code covered by the BSD License  

Highlights from
Toolbox Wavelets on Meshes

from Toolbox Wavelets on Meshes by Gabriel Peyre
A toolbox to compute wavelet transform on 3D meshes

clamp(x,a,b)
function y = clamp(x,a,b)

% clamp - clamp a value
%
%   y = clamp(x,a,b);
%
% Default is [a,b]=[0,1].
%
%   Copyright (c) 2004 Gabriel Peyr

if nargin<2
    a = 0;
end
if nargin<3
    b = 1;
end

y = max(x,a);
y = min(y,b);

Contact us at files@mathworks.com