image thumbnail


version (13 KB) by Jan
Min and Max over chunks of a vector


Updated 02 Jan 2015

View License

ChunkMinMax - min and max element of sub-vectors
[Mins, Maxs] = ChunkMinMax(X, Start, Stop, Valid)
X: Real double array.
Start, Stop: Vectors of type double.
Valid: If this is the string 'valid', X cannot contain NaNs and the function
runs 10% faster. Optional, default: 'nans'.
Mins, Maxs: Minimal and maximal values of the intervals:
NaN is replied for empty intervals.
data = rand(1, 100);
starts = [5 10 15 20]; stops = [9 14 19 24];
[mins, maxs] = ChunkMinMax(data, starts, stops);

The Mex-file is compiled the first time, when this function is called.
You can compile manually also:
mex -O ChunkMinMax.c
See the C-file for further instructions.
Pre-compiled files can be downloaded:
Run the unit-test uTest_ChunkMinMax after compiling to check validity and speed!

Cite As

Jan (2022). ChunkMinMax (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!