%% ROI Table Mask from Binary Sequences
% Generate an 18-by-2 mask of binary sequences. Use the mask to create a signalMask object and label the categories as A and B. Extract an ROI table mask from the object.

binSeqs = logical([ ...
    0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1;
    1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0]');

m = signalMask(binSeqs,'Categories',["A" "B"]);

roiTbl = roimask(m)

%
% Extend the regions of interest by one sample to the left and right.

m.RightExtension = 1;
m.LeftExtension = 1;

roiTbl = roimask(m)

% Copyright 2020 The MathWorks, Inc.