function [train,y_train,test,y_test]=split_train_test(data,seed,split,class_col)
%use seed
rand('seed',seed);
%number of rows
n=size(data,1);
%sample train indices without replacement split*n elements, 0<split<1
idxs_train=randperm(n);
idxs_train = idxs_train(1:floor(split*n));
%set rest of indices for test
idxs_test=setdiff(1:n,idxs_train);
%select data points for training
train=data(idxs_train,:);
%select true values for training
y_train=train(:,class_col);
%exclude column of true values
train(:,class_col)=[];
%same for test set
test=data(idxs_test,:);
y_test=test(:,class_col);
test(:,class_col)=[];
end