Main Content

brk2knt

Convert breaks with multiplicities into knots

Syntax

knots = brk2knt(breaks,mults)

Description

knots = brk2knt(breaks,mults)returns the sequenceknotsthat is the sequencebreaksbut withbreaks(i)occurringmults(i)times, alli。特别是,breaks(i)will not appear unlessmults(i)>0。If, as one would expect,breaksis a strictly increasing sequence, thenknotscontains eachbreaks(i)exactlymults(i)times.

Ifmultsdoes not have exactly as many entries as doesbreaks, then allmults(i)are set equal tomults(1)

Examples

The statements

t = [1 1 2 2 2 3 4 5 5]; [xi,m] = knt2brk(t); tt = brk2knt(xi,m)

give[1 2 3 4 5]forxi,[2 3 1 1 2]form, and, finally,tfortt

See Also