[article] How to apply function to every pair of columns in two matrices in MATLAB

matlab

04 Nov 2013

One may try

newvector = bsxfun(@(j,k)(func(A(j,:),B(k,:)),1:na,(1:nb)');

Note this trick cannot be applied to sparse matrices.

comments powered by Disqus