IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
blmisc_rows_shuffle.m
Go to the documentation of this file.
1 %> @brief Shuffles rows keeping spectra from the same group together or not
3  properties
4  %> whether to keep spectra from the same group together or not
5  flag_group = 1;
6  end;
7 
8  methods
9  function o = blmisc_rows_shuffle(o)
10  o.classtitle = 'Shuffle';
11  o.flag_params = 0; % I won't publish flag_group because will always want them together anyway
12  end;
13  end;
14 
15  methods(Access=protected)
16  function data = do_use(o, data)
17  if ~o.flag_group
18  p = randperm(data.no);
19  data = data.map_rows(p);
20  else
21  p = randperm(data.no_groups);
22  data = data.map_rows(data.get_obsidxs_from_groupidxs(p));
23  end;
24  end;
25  end;
26 end
27 
Shuffles rows keeping spectra from the same group together or not.
Base class for blocks that change a dataset row order.
Definition: blmisc_rows.m:2