Home > data-utility > granger_causality > gcause_libs > stream2intervals.m

stream2intervals

PURPOSE ^

SYNOPSIS ^

function intervals = stream2intervals(streams, category_list)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function intervals = stream2intervals(streams, category_list)
0002 
0003 [~, dim] = size(streams);
0004  intervals = cell(1, dim);
0005  
0006  for dimidx = 1:dim
0007      stream_one = streams(:, dimidx);
0008      mask_continue = [true; stream_one(2:end, 1) ~= stream_one(1:end-1, 1)];
0009      indices = find(mask_continue);
0010      intervals_one = [indices(1:end-1, 1) (indices(2:end, 1)) stream_one(indices(1:end-1))];
0011      
0012      if exist('category_list', 'var')
0013          intervals_one = intervals_one(ismember(intervals_one(:,3), category_list), :);
0014      end
0015      intervals{dimidx} = intervals_one;
0016  end
0017  
0018  if dim < 2
0019      intervals = intervals{1};
0020  end

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005