Mercurial > hg > plml
annotate matlab/general/cellmap.m @ 6:d3b9cbaee77b
Added Makefile to install Matlab components.
author | samer |
---|---|
date | Thu, 19 Jan 2012 14:28:39 +0000 |
parents | 0dd31a8c66bd |
children |
rev | line source |
---|---|
samer@0 | 1 function Y=cellmap(fn,X) |
samer@0 | 2 % cellmap - Map a function over a cell array |
samer@0 | 3 % |
samer@0 | 4 % cellmap :: (A->B, {[Size]->A}) -> {[Size]->B} |
samer@0 | 5 |
samer@0 | 6 % preallocate to fix size |
samer@0 | 7 Y=cell(size(X)); |
samer@0 | 8 for i=1:numel(X) |
samer@0 | 9 Y{i}=feval(fn,X{i}); |
samer@0 | 10 end |