MATLAB: Array size mismatch cellfun

cell arraysmatrix arraymatrix manipulation

Help me.
D = {[1 2],[1 1] ;[1 6 ],[5 2]}
L=[1 0 0 0; 0 1 0 0 ];
out=cellfun(@(x) x*L,D,'un',0)
In result:
size(D)=(2,2) ,size(L)=(2,4) , size(out)=(2,2) Why the size(out) is not equal to (2,4),as by matrix multiplication

Best Answer

The output of cellfun must always satisfy size(out)=size(D). Cellfun always operates on D element by element.