IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
data_merge_cols.m
Go to the documentation of this file.
1 %>@ingroup datasettools
2 %> @file
3 %> @brief Merges several datasets into one (column-wise)
4 %>
5 %> The new dataset ('out') will be first created as a clone of datasets(1), then column subsequently added to X, fea_x and fea_names
6 %>
7 %> Needless say the datasets need to be row-compatible.
8 %>
9 %> Classes, group_codes, classlabels etc are not checked for comptatibility. Assumes responsible use by the user.
10 
11 function out = data_merge_cols(datasets)
12 
13 % prepares a clone, except for the fields in rowfieldnames
14 out = datasets(1);
15 for j = 2:numel(datasets)
16  if out.no ~= datasets(j).no
17  irerror(sprintf('Dataset %d has number of rows different of dataset 1!', j));
18  end;
19  out.X = [out.X datasets(j).X];
20  out.fea_x = [out.fea_x datasets(j).fea_x];
21  out.fea_names = [out.fea_names datasets(j).fea_names];
22 end;
23 
24 
function irerror(in s)
function data_merge_cols(in datasets)
Analysis Session (AS) base class.
Definition: as.m:6