
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%  Title: StatisCLAS: A Package of Classification Methods   %%%%
%%%%  Author: David Casado de Lucas                            %%%%
%%%%  Version: 29th May 2013                                   %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% PURPOSE: This function determines an element to represent a sample.

% INPUT VARIABLES:
%    numberReference: Number of the method to be applied.
%    infoReference: Possible necessary additional information for the previous method.
%    matrixInput: Matrix with the elements as rows.

% OUTPUT VARIABLES:
%    reference: Reference element.
%    outputInfo: Possible additional output information.

function [reference outputInfo] = referenceElement(numberReference, infoReference, matrixInput)
  switch numberReference
    case 1  % The mean (for a vector, function or time series)
      reference = mean(matrixInput);
      outputInfo = [];  % Trick
    case 2  % The trimmed mean (for functions)
      alpha = infoReference{1};
      [reference outputInfo] = trimFunction(matrixInput, alpha); % With two arguments, the trimmed mean
  end
end
