%% Function: cut data into blocks, based on onset-triggers function [blocks] = cutblockOnset(data,trigs,blocklen,nBlck) blocks = zeros(blocklen,nBlck); for b = 1:nBlck blocks(:,b) = data(trigs(b):trigs(b)+blocklen-1); % cut block b, starting at trigger b with length of one block end