function [X,Y,Xt,Yt]=splitData(S,y,n,num)
[m,~]=size(S);
if ~exist('num','var');
    num=0;
end
idx=1:m;
shift=num*n;
X=S(idx((1+shift):(n+shift)),:);
Y=y(idx((1+shift):(n+shift)),:);
Xt=[S(idx(1:(1+shift)),:); S(idx((n+shift+1):end),:)];
Yt=[y(idx(1:(1+shift)),:); y(idx((n+shift+1):end),:)];