File Exchange

image thumbnail

group1s

version 1.0.0 (1.29 KB) by Matt J
Assign numerical labels to groups of ones in a binary vector

2 Downloads

Updated 10 Jul 2020

View License

This FEX submission provides the very simple function group1s.m which is basically a 1D version of bwlabel.Given a logical vector as input, it will replace all groups of consecutive 1's with a numerical label.

EXAMPLE:

>> xbinary=logical([1 0 0 1 1 1 0 1 1 0]);
>> labelmap = group1s(xbinary)

labelmap =

1 0 0 2 2 2 0 3 3 0

This can be useful for processing consecutive regions of a signal vector using splitapply().

Cite As

Matt J (2020). group1s (https://www.mathworks.com/matlabcentral/fileexchange/78008-group1s), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

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