Tools for Processing Consecutive Repetitions in Vectors

版本 3.0.9 (12.1 KB) 作者: Matt J
A set of functions for labeling and manipulating groups of consecutively repeating elements in a vector.
119.0 次下载
更新时间 2023/1/25

查看许可证

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.

引用格式

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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2020a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
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