IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
methodcaller.m
Go to the documentation of this file.
1 %> @brief Calls a method from input block
2 %>
3 %> Has a constructor to set string to evaluate.
4 %>
5 classdef methodcaller < block
6  properties
7  %> String to be eval()'d as 'input.%s'
8  string = [];
9  end;
10 
11  methods
12  %> @param s String for the @c string property
13  function o = methodcaller(s)
14  if nargin < 1
15  s = '';
16  end;
17  o.classtitle = 'Method caller';
18  o.flag_ui = 0;
19  o.flag_params = 0;
20  o.flag_bootable = 0;
21  o.flag_trainable = 0;
22  o.string = s;
23  end;
24  end;
25 
26  methods(Access=protected)
27  function out = do_use(o, input) %#ok<*INUSD,*STOUT>
28  eval(sprintf('out = input.%s;', o.string));
29  end;
30  end;
31 end
Calls a method from input block.
Definition: methodcaller.m:5
Base Block class.
Definition: block.m:2