Home > data-import > supporting_functions > event2cstream_v2.m

event2cstream_v2

PURPOSE ^

Make sure events are in order

SYNOPSIS ^

function cstream = event2cstream_v2(event, timeseries, value)

DESCRIPTION ^

Make sure events are in order

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cstream = event2cstream_v2(event, timeseries, value)
0002 
0003 %Make sure events are in order
0004 event = sortrows(event, [1 2]);
0005 
0006 cstream = cat(2, timeseries, zeros(numel(timeseries), 1));
0007 for e = 1: size(event, 1)
0008     start = event(e,1);
0009     final = event(e,2);
0010     [~, is] = min(abs(cstream - start));
0011     [~, ifinal] = min(abs(cstream - final));
0012     cstream(is:ifinal, 2) = value;
0013 end
0014 
0015 
0016 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005