clip
clip(x,xmin,xmax,varargin) returns a clipped or trimmed array containing only the values of x between xmin and xmax, inclusive. Inclusion of any other arrays as inputs returns corresponding clipped arrays. The optional argument 'exclusive' can be included to return only values between but not including xmin and xmax.
INPUTS AND OUTPUTS:
xclp = clip(x,xmin,xmax) returns an array of all values in x from xmin to xmax, inclusive.
xclp = clip(x,xmin,xmax,'exclusive') returns an array of all values in x from xmin to xmax, exclusive.
[xclp,ind] = clip(x,xmin,xmax) returns an array of all values in x from xmin to xmax, and also returns the indices of x corresponding to xclp. Note that xclp = x(ind).
[xclp,yclp] = clip(x,xmin,xmax,y) returns xclp and corresponding clipped values of the array y, which should be the same length as x.
[xclp,y1clp,y2clp,...,ynclp] = clip(x,xmin,xmax,y1,y2,...yn) returns clipped arrays of x and y1 through yn.
[xclp,y1clp,y2clp,...,ynclp,ind] = clip(x,xmin,xmax,y1,y2,...yn) returns clipped arrays of x and y1 through yn and corresponding indices ind. xclp = x(ind) and y1clp = y1(ind) and so on.
In the example image above, y1 through y4 were declared, and with an interest in values from x=70 to x=90, the clipped x and y arrays were found like this:
[xc,y1c,y2c,y3c,y4c] = clip(x,70,90,y1,y2,y3,y4);
Cite As
Chad Greene (2024). clip (https://www.mathworks.com/matlabcentral/fileexchange/43131-clip), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: CLIP2
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |