Mercurial > hg > ishara
view general/cellutils/cellzip.m @ 42:ae596261e75f
Various fixes and development to audio handling
author | samer |
---|---|
date | Tue, 02 Dec 2014 14:51:13 +0000 |
parents | 47cb292350f3 |
children |
line wrap: on
line source
function Y=cellzip(fn,varargin) % cellzip - Zip cell arrays with a function % % cellzip :: ( % (D1,...,Dn)->R ~ function of n arguments, % {[size]->D1}, ..., {[size]->Dn} ~ n cell arrays of appropriate types % ) -> {[size]->R} ~ cell array of results % preallocate to fix size sizes=cellmap(@size,varargin); sz=sizes{1}; for i=1:nargin-1 if ~all(sizes{i}==sz), error('Sizes do not match'); end end Y=cell(sz); for i=1:prod(sz) args=cellmap(@(c)c{i},varargin); Y{i}=fn(args{:}); end