% divideset.m 

% function for dividing 'data' to 'train' and 'test' set
% how many percents goes to training set is determined
% by treshold

function [test, train]=divideset(data,treshold)

[x, y]=size(data);
rnd=rand(1,x);
[rnds, srt]=sort(rnd);
treshold=round(x*treshold/100);
trn=find(rnd<rnds(treshold));
tst=find(rnd>=rnds(treshold));
train=data(trn,:);
test=data(tst,:);

return