% SaveCCIModel - Save a CCI model to file
% C = SaveCCIModel(B,B0,K,D,XMeanCenter,name,autoscale)
% Save 3 linear models as well as name and scaling parameter
% as CCI model file. A dialog is displayed enabling the user
% to specify the name of the *.xml file to be saved.
% A linear model is specified by the equation:
% y_ = b * x_ + b0
% Where y_ is the predicted value of the mean centered spectra
% x_, b is an array of length x and b0 is a scalar. In addition
% scaling can be applied to the predicted values. When
% autoscaling is on, the Studio program scales the resulting
% image (prediction image) according the user's selection in the
% program regardless of the scaling parameters k and d. In case
% autoscaling is off, the predictions (y_) are scaled according
% the following equation:
% y = k y_ + d
% In case k=1 and d=0 and autoscaling is off, no scaling is
% applied to the predictions (therefore: y = b * x_ + b0).
% Typically for chemometric modelling is mean centering
% of the spectra. This is done by the following equation:
% x_ = x - xMeanCenter
% Where x_ is the "mean centered spectra", x is the input spectra
% and xMeanCenter is the "mean center spectra".
% B is composed of 3 b-vectors:
% B = [b_1; b_2; b_3];
% B0 is composed of 3 b0-values:
% B0 = [b0_1, b0_2, b0_3];
% K is composed of 3 k-values:
% K = [k_1, k_2, k_3];
% D is composed of 3 d-values:
% D = [d_1, d_2, d_3];
% XMeanCenter is composed of 3 mean-center-spectra:
% XMeanCenter = [xMeanCenter_1; xMeanCenter_2; xMeanCenter_3];
% name is a string specifying the name of the CCI model.
% autoscale is a boolean variable specifying whether
% autoscaling should be applied or not (in the Studio program).
% C = SaveCCIModel(filename,...)
% Same as above excepted the model is saved to the file specified by
% the string filename.
% 21-10-14 - [Markus Burgstaller] First version
% 23-10-14 - [Markus Burgstaller] Param names updated
% 03-03-15 - [Markus Burgstaller] Now output is a xml-file of ending fltp
% (c)2015 Perception Park GmbH, Graz/AUSTRIA