# matrixfunction

28 Feb 2009 (Updated )

summary

matrixfunrcn(hFunction,A,B)
```function Y = matrixfunrcn(hFunction,A,B)
% matrixfunrcn
%   Y = matrixfunrcn(hFunction,A,B)
%
%   Invokes hFunction on the rows of matrix A and the columns of matrix B.
%   hFunction is a function handle that accepts two vectors.
%   hFunction is invoked aRows*(2*bCols-aRows+1)/2 times.
%   Y is a cell matrix of size([aRows bCols]).
%
%   Example
%       A = [1 2 3; 4 5 6; 7 8 9]
%       Y = matrixfunrcn(@dot,A,A);         % Simple example, same as A*A
%       Y = [ 30]    [ 36]    [ 42]
%              []    [ 81]    [ 96]
%              []       []    [150]
%
%       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,1);                             % Matrix size
nB = size(B,2);                             % Matrix size
Y = cell([nA nB]);                          % Prefine loop variable
for i = 1:nA                              	% Loop through each row
for j = i:nB                            % Loop through each column
Y{i,j} = hFunction(A(i,:),B(:,j).');% Invoke function
end
end
end
```