IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
get_suffix.m
Go to the documentation of this file.
1 %>@ingroup codegen string
2 %> @file
3 %> @brief Finds a suffix based on the class name. Isolates the bit after the last undescore
4 %> @todo Could respond to IRootLab setup to change the way new generated objects are named, i.e. how they appear in objtool and datatool
5 %
6 %> @param clname Class name.
7 %> @param no_trim
8 function suffix = get_suffix(clname, no_trim)
9 if ~exist('no_trim', 'var') || isempty(no_trim)
10  no_trim = 1;
11 end;
12 pos = strfind(clname, '_');
13 if isempty(pos)
14  suffix = clname;
15 else
16  pospos = numel(pos)-no_trim+1;
17  if pospos > numel(pos)
18  i1 = numel(clname)+1;
19  elseif pospos < 0
20  i1 = 1;
21  else
22  i1 = pos(pospos)+1;
23  end;
24  suffix = clname(i1:end);
25 end;
function objtool(in varargin)
function get_suffix(in clname, in no_trim)