function xClass = classForest(Forest,X)
% xClass = classForest(Forest,X)
%
% Forest the trained random forest (list of decision trees)
% X examples to classify
%
% Classifies examples X and returns their predicted labels xClass.

	if nargin < 2 %returns error in case the number of argument is less than two
		error('Too few input parameters.');
	end
	n=length(Forest); %get the length of the random forest
	Y=zeros(n,size(X,1)); %initialize the classification result
	for i=1:n
		Y(i,:) = classTree(Forest{i}, X); %classify X using decision tree number i
    end
    xClass=mode(Y)'; %returns the majority vote of each instance predictions
end
