%% Binary Sequences Mask from ROI Table
% Consider a region-of-interest (ROI) table mask with four regions of interest spanning samples numbered from 2 to 19. Specify the category labels as A, B, and C. Use the mask to create a signalMask object.

roiTbl = table([2 5; 7 10; 15 18; 17 19],["A" "B" "C" "A"]');

m = signalMask(roiTbl);

%
% Extract a binary sequences mask from the object. Specify a sequence length of 20 samples.

binSeqs = binmask(m,20)'

%
% Shorten the regions of interest by one sample from the right and extend them two samples to the left. Extract the modified mask, specifying a sequence length of 18 samples.

m.RightShortening = 1;
m.LeftExtension = 2;

binSeqs = binmask(m,18)'

% Copyright 2020 The MathWorks, Inc.