view m-toolbox/classes/@matrix/wrapper.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

% WRAPPER applies the given method to each object in the matrix.
% 
% CALL 
%          out = wrapper(objs, pl, info, inputnames, methodName)
% 
% $Id: wrapper.m,v 1.1 2011/08/23 13:50:36 hewitson Exp $
% 
function varargout = wrapper(varargin)
  
  % Collect all matrix objects and plists
  objs       = varargin{1};
  pl         = varargin{2};
  info       = varargin{3};
  inputnames = varargin{4};
  methodName = varargin{5};
  
  % Merge with default plist: done in the ao method
    
  % deep copy
  mat = copy(objs,1);
  
  n = numel(mat);
  
  % loop over number of matrices
  for ii = 1:n
    % get size of object
    [rw,cl] = size(mat(ii).objs);
    
    % loop over raws and columns
    for kk = 1:rw
      for jj = 1:cl
        mat(ii).objs(kk,jj) = feval(methodName, mat(ii).objs(kk,jj),pl);
      end
    end
    mat(ii).addHistory(info, pl, {inputnames(ii)}, [mat(ii).hist]);
  end
  
  varargout{1} = mat;  
  
  
end