IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
blmisc_classlabels_rename.m
Go to the documentation of this file.
1 %> @brief Renames class labels.
2 %>
3 %> There should be no duplicate names and number of levels should remain the same.
4 %>
5 %> @sa uip_blmisc_classlabels_rename.m
7  properties
8  classlabels_new;
9  end;
10 
11  methods
12  function o = blmisc_classlabels_rename(o)
13  o.classtitle = 'Rename';
14  end;
15  end;
16 
17  methods(Access=protected)
18  function data = do_use(o, data)
19  if length(o.classlabels_new) ~= length(data.classlabels)
20  irerror('New class label must have same number of elements!');
21  end;
22 
23  nl = data.get_no_levels();
24 
25  data.classlabels = o.classlabels_new;
26 
27  % Uses the following function with full-level selection in order to condense eventual repetitions in the class labels
28  data = data_select_hierarchy(data, 1:data.get_no_levels());
29  end;
30  end;
31 end
32 
function data_select_hierarchy(in data, in hierarchy)
function irerror(in s)
Base class for blocks that change a dataset class labels.