function timePointMatrix = buildTimePointMatrix(timeline,argStruct)


timeLineStart   = timeline.frameShiftStart;
timeLineEnd     = timeline.frameShiftEnd;
globalStart     = timeline.psthStart;
globalEnd       = timeline.psthEnd;
decodeDuration  = timeline.decodeDuration;

pst             = argStruct.pst;
eventList       = argStruct.eventList;
labelMap        = argStruct.labelMap;

timePointMatrix = {};
%%% build timepoint Matrix
for timeShift   = timeLineStart:1:timeLineEnd
    % center timepoint && relative shift
    frameStart  = floor(-globalStart+1+timeShift - 0.5*decodeDuration);
    frameEnd    = min(ceil(frameStart+decodeDuration + 0.5*decodeDuration),-globalStart+globalEnd);

    %build svm inputmatrix
    index = timeShift-timeLineStart+1; %Bad 1-indexing :-(
    timePointMatrix{index} =[];
    anyvoxel = 1;
    for pstConditionGroup = 1:size(pst{1,anyvoxel},2)
        for dp = 1:size(pst{1,anyvoxel}{1,pstConditionGroup},1) % data point
            row = lm_getSVMLabel(labelMap,eventList(pstConditionGroup,1));
            for voxel = 1:size(pst,2)
                row = [row, pst{1,voxel}{1,pstConditionGroup}(dp,frameStart:frameEnd)]; % label,[value,value,...],[value,value,...]...
            end
            timePointMatrix{index}  = [timePointMatrix{index}; row];
        end
    end
end

end