function [A_test,B_test,A_train,B_train] = cross_sets(A,B,Agroups,Bgroups,i)
% CROSS_SETS determines the sets to use in cross-validation process.
%
%	[A_test,B_test,A_train,B_train] = cross_sets(A,B,Agroups,Bgroups,i)
%
%	A_test: points of set A to use in testing
%	B_test: points of set B to use in testing
%	A_train: points of set A to use in training
%	B_train: points of set B to use in training
%	A: points in the set A
%	B: points in the set B
%	Agroups: vector detailing the division of the set A
%	Bgroups: vector detailing the division of the set B
%	i: counter telling which group we are working with
%
%	This function (used in conjunction with function cross_makegroups)
%	keeps the same relative number of points of A and points of B
%	in the training and testing sets.

% start
A_test = A(Agroups(i):Agroups(i+1)-1,:);
B_test = B(Bgroups(i):Bgroups(i+1)-1,:);
A_train = [ A(1:Agroups(i)-1,:);A(Agroups(i+1):size(A,1),:)];
B_train = [ B(1:Bgroups(i)-1,:);B(Bgroups(i+1):size(B,1),:)];

