Tools for Processing Consecutive Repetitions in Vectors

Versión 3.0.9 (12,1 KB) por Matt J
A set of functions for labeling and manipulating groups of consecutively repeating elements in a vector.
121 descargas
Actualizado 25 ene 2023

Ver licencia

This FEX submission provides some functions that are similar to MATLAB's usual findgroups() and splitapply() commands, except that they are specifically well-suited to scenarios where the groups are subsets of consecutively repeating elements in a vector.
EXAMPLE: To find the run lengths of consecutive non-zero elements in,
>> X=[0 0 4 7 6 1 3 0 0 0 1 11 3 8 0 0 47 14];
one can simply do,
>> runlengths = groupFcn(@length, X, groupTrue(X>0) )
runlengths =
5 4 2
For a more detailed description and examples, see the Examples tab.

Citar como

Matt J (2024). Tools for Processing Consecutive Repetitions in Vectors (https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vectors), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2020a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
3.0.9

Small bug fix in groupConsec.m
Only affected case when the input sequence started with 0.

3.0.8

Updates Examples.mlx to include an illustration of groupLims().

3.0.7

More documentation fixes

3.0.6

Some documentation corrections.

3.0.5

Upgraded groupReductFcn and groupReductHybrid with the capability of taking matrix-valued input.

3.0.4

Added some new functions: groupLims, groupReductFcn, and groupReductHybrid.

3.0.3

Fixed small bug in groupFcn. Error message was triggered in the case of multi-input functions.

3.0.2

Edit

3.0.1

Edit

2.0.6

Renamed group1s to groupTrue

2.0.5

Edits

2.0.4

Edits

2.0.3

Edited text and examples.

2.0.2

Small text edits

2.0.1

Small text edits

2.0.0

Added groupConsec and groupFcn

1.0.0