function[spldata,time] = splitdata(data,split,trans)

if(nargin<3)
    trans=0;
end

M=length(data);

for i=1:split
    time{i} = [];
end

for m=1:M
      
    if(trans)
        [dim,T] = size(data{m});
    else
        [T,dim] = size(data{m});
    end
    
    len = floor(T/split);
       
    for i=1:split
        
        time{i} = [time{i} len];

        index = mod(i+m,split);

        if(trans)
            spldata{i,m} = data{m}(:,index*len+1:(index+1)*len);
        else
            spldata{i,m} = data{m}(index*len+1:(index+1)*len,:);
        end

    end
    
end

