1function [T L] = mtrace_merge(t1, t2)
2% Merges two traces in a single marked (multiclass) trace
4% t1: inter-arrival times of the first trace
5% t2: inter-arrival times of the second trace
7% T: inter-arrival times of the marked process
8% L: labels of the marked process
10[TCUM,IDX] = sort([0; cumsum(t1); cumsum(t2)]);
13L = zeros(length(T),1);
14L(IDX >= 2 & IDX <= 1+length(t1)) = 1;
15L(IDX >= 2+length(t1) & IDX <= 1+length(t1)+length(t2)) = 2;