matrixfunction

by

 

28 Feb 2009 (Updated )

summary

matrixfunic(hFunction,A)
function Y = matrixfunic(hFunction,A)
% matrixfunic
%   Y = matrixfunic(hFunction,A)
%
%   Invokes hFunction on the columns of matrix A. 
%   hFunction is a function handle that accepts two vectors.
%   hFunction is invoked aCols times.
%   Y is a cell matrix of size([aCols 1]). 
%
%   Example
%       A = magic(3);
%       Y = matrixfunic(@sum,A);         
%       Y = [15]
%           [15]
%           [15]
%
%   See also
%       matrixfun matrixfunrr matrixfunrc matrixfuncc matrixfuncr matrixfunt
%       matrixfunn matrixfunrrn matrixfunrcn matrixfunccn matrixfuncrn matrixfuntn
%       matrixfuni matrixfunir matrixfunic
%

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

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

Contact us