# matrixfunction

28 Feb 2009 (Updated )

summary

matrixfuncc(hFunction,A,B)
```function Y = matrixfuncc(hFunction,A,B)
% matrixfuncc
%   Y = matrixfuncc(hFunction,A,B)
%
%   Invokes hFunction on the columns of matrices A and B.
%   hFunction is a function handle that accepts two vectors.
%   hFunction is invoked aCols*bCols times.
%   Y is a cell matrix of size([aCols bCols]).
%
%   Example
%       A = [1 2 3; 4 5 6; 7 8 9]
%       Y = matrixfuncc(@dot,A,A);         % Simple example, same as A'*A
%       Y = [66]    [ 78]    [ 90]
%           [78]    [ 93]    [108]
%           [90]    [108]    [126]
%
%       matrixfun matrixfunrr matrixfunrc matrixfuncc matrixfuncr matrixfunt
%       matrixfunn matrixfunrrn matrixfunrcn matrixfunccn matrixfuncrn matrixfuntn
%       matrixfuni matrixfunir matrixfunic
%

%% Author Information
%   Smart Systems Integration Group
%	Cork Institute of Technology
%

%%
nA = size(A,2);                             % Matrix size
nB = size(B,2);                             % Matrix size
Y = cell([nA nB]);                          % Prefine loop variable
for i = 1:nA                              	% Loop through each column
for j = 1:nB                            % Loop through each column
Y{i,j} = hFunction(A(:,i),B(:,j));  % Invoke function
end
end
end
```