 Clustering(X, varargin) is the main function. This function takes as input the original data set (three-way or two-way), 
 distance and clustering preferences. It then computes the model and applies hierarchical clustering based on the distance 
 and linkage method given as input parameters. 

 Inputs:   X: two-way or three-way array
           vargin(1): flag_label 0/1
           vargin(2): flag_color 0/1
           vargin(3): class id
           vargin{4}: linkage method
           vargin{5}: distance measure
 optional: method : {'tucker', 'parafac', 'matrix'}
           param  : {number of components, 'scores' or 'residuals'} if 'tucker' or 'parafac'
                               1  if  'matrix'(Distance between two samples are computed by calculating the Frobenius norm)
                                              (of the matrices corresponding to the slices.)
                               
 Example: For three-way array, X,
               Clustering(X,0,1,1,'complete','mahalanobis', 'tucker',{[2 2 2], 'scores'});
               Clustering(X,0,1,2,'complete','mahalanobis', 'parafac',{2, 'scores'});
               Clustering(X,0,1,1,'complete','mahalanobis', 'matrix', 1);

          For two-way array, X
               Clustering(X,0,1,1,'complete','mahalanobis');

 
 Last modified: 05/21/2007
 Version 1

 Reference:
 Evrim Acar, Rasmus Bro, Bonnie Schmidt, New Exploratory Metabonomic Tools, Submitted to Journal of Chemometrics, 2007.
