views:

32

answers:

1

So I have two cell arrays:

A = {2 2 2 2}
B = {[1 2] [3 2] [5 5] [7 7]}

and a function of two arguments:

F = @(a, b) [a * b(1), (b(2) / 3), (b(1) + a) * 22]

And I want to apply the function to the two cell arrays like so:

idealfun(F, A, B)

and have it do the right thing (return a cell array with four cells of 1x3 vectors). Any ideas how to find/write idealfun?

+4  A: 

Use CELLFUN.

out = cellfun(F,A,B,'UniformOutput',false);
Jonas
Ya, knew about cellfun, DID NOT KNOW IT WORKED FOR MULTIPLE CELL ARRAYS. That is awesome. Thank you.
kaleidomedallion