fabien van mook

all packages "fvm-*"

package "fvm-miscellaneous"

function file "findconsec.m"

Function g = findconsec(b)

finds indices in one-dimensional matrix of
booleans, b, and returns the found indices
in groups, so that the indices in each group
form consecutive numbers: i(k) - i(k-1) == 1.

Output argument g is always a cell array.

E.g. findconsec([1 0 1 1 1 0 0 1 1] == 1)
returns: { [1], [3, 4, 5], [8, 9] }.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-miscellaneous" under GNU GPLv3+