function [y, phi, eventList] = yFromGt(gt)

[t, K]  = size(gt);
nEvents = 0;
evtBef  = zeros(1, K);
eventList = [];
for i = 1:t

    evt = gt(i, :);
    
    if norm(evtBef - evt)>eps
        nEvents      = nEvents + 1;
        eventList = [eventList; find(gt(i, :)==1)];
    end
    
    evtBef = evt;
    
end

y   = zeros(t, nEvents);
phi = zeros(nEvents, K);

gtBef = zeros(1, K);
evtCur = 0;

for i = 1:t

    if norm(gt(i, :) - gtBef)
        evtCur = evtCur + 1;
        phi(evtCur, :) = gt(i, :); 
    end
    
    y(i, evtCur) = 1;
    gtBef = gt(i, :);
end

end