


LEADING_EDGES Marks 0 -> NONZERO transitions in binary data. EDGEMARKERS = LEADING_EDGES(BINARYDATA) takes an M x N matrix BINARYDATA and returns a M x N matrix EDGEMARKERS, containing a '1' in each location that corresponds to the first nonzero value in a BINARYDATA column following one or more zeros above it in the same column. EDGEMARKERS is of type logical. NOTE: If the first row of any BINARYDATA column contains a nonzero value, it will be marked in EDGEMARKERS.


0001 function markers = leading_edges(data) 0002 %LEADING_EDGES Marks 0 -> NONZERO transitions in binary data. 0003 % EDGEMARKERS = LEADING_EDGES(BINARYDATA) takes an M x N matrix 0004 % BINARYDATA and returns a M x N matrix EDGEMARKERS, containing a '1' in 0005 % each location that corresponds to the first nonzero value in a 0006 % BINARYDATA column following one or more zeros above it in the same 0007 % column. EDGEMARKERS is of type logical. 0008 % 0009 % NOTE: If the first row of any BINARYDATA column contains a nonzero 0010 % value, it will be marked in EDGEMARKERS. 0011 0012 markers = [diff([repmat(logical(0), 1, size(data,2)); (data>0)], 1, 1) > 0];