Last active
August 29, 2015 14:00
-
-
Save ibogun/11098273 to your computer and use it in GitHub Desktop.
Matlab tricks;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% let g be anonymous function | |
% apply function on every row of a matrix | |
applyOnEveryRaw =@(A,fun) cell2mat(cellfun(fun, num2cell(A, 2), 'UniformOutput', false)); | |
% apply function on every column of a matrix | |
applyOnEveryColumn=@(A,fun) cell2mat(cellfun(fun, num2cell(A, 1), 'UniformOutput', false)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment