comparison m-toolbox/classes/@history/rebuild.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % REBUILD rebuilds the orignal object using the history.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: REBUILD rebuilds the orignal object using the history.
5 % Necessary for the ltpda_uoh/rebuild method.
6 %
7 % CALL: out = rebuild(h)
8 % out = rebuild(h, pl)
9 %
10 % INPUTS: h - array of history objects
11 % pl - configuration PLIST for the history/hist2m method
12 %
13 % OUTPUTS: out - array of rebuilt objects.
14 %
15 % VERSION: $Id: rebuild.m,v 1.7 2011/11/16 08:25:59 mauro Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = rebuild(varargin)
20
21 import utils.const.*
22
23 % Get history objects
24 hs = varargin{1};
25 pl = [];
26
27 % Get configuration PLIST
28 if nargin >= 2
29 pl = varargin{2};
30 end
31
32 % Go through each input AO
33 bs = [];
34 for jj = 1:numel(hs)
35
36 % convert to commands
37 if isempty(hs(jj))
38 cmds = {'a_out = [];'};
39 else
40 if isempty(pl)
41 cmds = hist2m(hs(jj));
42 else
43 cmds = hist2m(hs(jj), pl);
44 end
45 end
46
47 % execute each command
48 for kk = numel(cmds):-1:1
49 utils.helper.msg(msg.PROC4, 'executing command: %s', cmds{kk});
50 eval(cmds{kk});
51 end
52
53 % add to outputs
54 bs = [bs a_out];
55
56 end % End object loop
57
58 % Set output
59 varargout{1} = bs;
60
61 end