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.
ダウンロード: 121
更新 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