DefineArray
Location: ..\cubatch\Common\DefineArray.m

function [Data,Con,Sams] = DefineArray (Model,XorY,CalorTest,Flag);
Description:
It extracts the subset according to the selection of both samples/batches and variables stored in the ModelIn structure (in sam and var, respectively).
Inputs:
Model: ModelIn structure
XorY: it is the index within the X data structure. If 1, Data refers to X{1}, if 2, to X{2} (i.e. Y).
The need to specify within this function is a relish of an old syntax, currently one variable is assigned either to X or to Y if it belongs to X{1} or X{2} respectively.This ambiguity will likely be removed in the next revision of this file.
CalorTest: it can assume values 1, 2, or 0; Data will then contain the samples/batches assigned respectively to the calibration set,to the test set or to both.
Flag: determines the class of the elements of Data (i.e. cbdataset or double/cell)

Outputs:
Data: is a cell vector length 1 or 2 (obsolete ambiguity that will be removed in the next release). If Flag is 1, Data is a cell array of cbdataset objects (either of type: 'Data' or 'Batch', depending on the type of the sets stored in the X data structure). If Flag is 0, Data is an n-way array for 'single set' - i.e. of type 'Data' - data sets and a cell vector for 'multiple set' - i.e. of type 'Batch' - data sets (to account for possibly different lengths).
Con: cell vector of length 1 or 2 with the Content objects relative to the selection.
Sams: position of the samples/batches in the X data structure.
Vars: cell vector where each element refers to a mode of the selected array (either X or Y, with the same ambiguity as before). Each element contains the selected variables in the original array in the corresponding mode.

Called by:
Model_nPLS1\Calculate, Model_PARAFAC\Calculate, ExportData
Subroutines:
Internal: none
External: getcvdata

Author:
Giorgio Tomasi
Royal Agricultural and Veterinary University
MLI, LMT, Chemometrics group
Rolighedsvej 30
DK-1958 Frederiksberg C
Danmark
Last modified: 21-Oct-2002 07:49:04
Contact: Giorgio Tomasi, gt@kvl.dk
References