comparison m-toolbox/classes/@matrix/wrapper.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 % WRAPPER applies the given method to each object in the matrix.
2 %
3 % CALL
4 % out = wrapper(objs, pl, info, inputnames, methodName)
5 %
6 % $Id: wrapper.m,v 1.1 2011/08/23 13:50:36 hewitson Exp $
7 %
8 function varargout = wrapper(varargin)
9
10 % Collect all matrix objects and plists
11 objs = varargin{1};
12 pl = varargin{2};
13 info = varargin{3};
14 inputnames = varargin{4};
15 methodName = varargin{5};
16
17 % Merge with default plist: done in the ao method
18
19 % deep copy
20 mat = copy(objs,1);
21
22 n = numel(mat);
23
24 % loop over number of matrices
25 for ii = 1:n
26 % get size of object
27 [rw,cl] = size(mat(ii).objs);
28
29 % loop over raws and columns
30 for kk = 1:rw
31 for jj = 1:cl
32 mat(ii).objs(kk,jj) = feval(methodName, mat(ii).objs(kk,jj),pl);
33 end
34 end
35 mat(ii).addHistory(info, pl, {inputnames(ii)}, [mat(ii).hist]);
36 end
37
38 varargout{1} = mat;
39
40
41 end
42