function [ TestResult Y_latent_test]=pr_test_MLDA(testingdata,w_fda ,threshold ,m1_lda, m2_lda )

% *************************************************************************
% This function is used to  predict the label of testing data. The
% classifer can be obtained from training data based on MLDA method.
% The input data was calculated by function pr_MLDA.

% Input:

%      testingdata:  the testing data.A matrix 1*m, m is the number of the
%                    features. Note that the program used leave-one-out
%                    Cross validation.

%            w_fda:  the weight vector of the selected features. A vector
%                    s*1, s is the number of the selected features.

%        threshold:  the separation of two classes data based on training
%                    data in one-dimensional feature space.

%           m1_lda:  the mean value of the patient data in one-dimensional
%                    feature space

%           m2_lda:  the mean value of the control data in one-dimensional
%                     feature space.

% Output:

%       TestResult:  predicting the label of testing data.

%    Y_latent_test:  predicting the value of testing data in one-dimensional
%                    feature space.

% Written by Zhengjia Dai, State Key Laboratory of Cognitive Neuroscience
% and Learning, Beijing Normal University, Beijing, P.R.China, 100875. 
% Contact information:
% Zhengjia Dai: daizhengjia13@gmail.com
% Yong He : yong.h.he@gmail.com; yong.he@bnu.edu.cn
% September 24th,2011
% *************************************************************************

% calculating the value of testing data in one-dimensional feature space.
Y_latent_test=testingdata*w_fda;

% predicting the label of testing data
if(m1_lda<=m2_lda)
    if(Y_latent_test<threshold)
        TestResult =-1;
    else
        TestResult =1;
    end
else
    if(Y_latent_test<threshold)
        TestResult =1;
    else
        TestResult=-1;
    end
end



