IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
get_varnames2.m
Go to the documentation of this file.
1 %>@ingroup codegen
2 %> @file
3 %> @brief Variable names in workspace matching class
4 %>
5 %> Returns a cell of cells of strings. Each inner cell will have all variables matching a corresponding element in @ref classnames
6 function vars = get_varnames2(classnames)
7 if ~iscell(classnames)
8  classnames = {classnames};
9 end;
10 no_classes = numel(classnames);
11 vars0 = evalin('base', 'who');
12 n = numel(vars0);
13 
14 flag_progress = n > 100;
15 
16 if flag_progress
17  ipro = progress2_open('GET_VARNAMES2', [], 0, n);
18 end;
19 
20 vars = repmat({{}}, 1, no_classes);
21 for i = 1:n
22  if ~ismember(get_excludevarnames(), vars0{i}) %> operational names such as 'o' are excluded from list
23  var = evalin('base', [vars0{i}, ';']);
24  matches = arrayfun(@(cn) isa(var, cn{1}), classnames);
25  if any(matches)
26  ii = find(matches);
27  for j = 1:numel(ii)
28  vars{ii(j)}{end+1} = vars0{i};
29  end;
30  end;
31  end;
32 
33  if flag_progress
34  ipro = progress2_change(ipro, [], [], i);
35  end;
36 end;
37 
38 if flag_progress
39  progress2_close(ipro);
40 end;
function progress2_change(in prgrss, in title, in perc, in i, in n)
function progress2_open(in title, in perc, in i, in n)
function get_excludevarnames()
function get_varnames2(in classnames)
function progress2_close(in prgrss)
Analysis Session (AS) base class.
Definition: as.m:6