MATLAB: Multiply cell doubles with a matrix

multiply cell doubles with a matrix

I have a cell array A which has 1*5 cell, each cell has 12*1 doubles.
How multiply those 12*1 doubles with a MATRIX call B with 12*500 ?
Thank you

Best Answer

out = bsxfun(@times,permute(cell2mat(A),[1,3,2]),B); % out - 3D double array
or
out = cellfun(@(x)bsxfun(@times,x,B),A,'un',0); % here out - cell array (1 x 5)