MATLAB: Sum of Multiplication of column values in cell array

cell arrays

hey i have a cell array x
x{1,1}= {[ *3*,1,6.9,3.6,4,2.3,3,5,4.12],[ *3*,1,4,3,4,2,3.4,5,4],[ *3*,1.9,4,9.21,4,2.2,3,5,4.2],[ *2*,1.8,3.8,2,4,2.1,4,5,4.1]}
x{2,1}= {[1,1,5,3.6,4,2.3,3,2,4.12],[3,4,4,3,4,2,8,5,4],[1,5,4,7,4,2.9,3,5,4.2],[3,1.9,4.8,2,4,2.1,5,5,6]}
and similarly other elements x{3,1} x{4,1} etc. And other array y:
y= {[1,2,1.2,0.2];[0.32,0.42,0.4,0.07]}
I want to take each col value one by one and multiply it with the corresponding value in y and then add them all. Like this:
(3*1) + (3*2) + (3*1.2) + (2*0.2) [3,3,3,2 are bold values in x{1,1}]
and similarly take 2nd col of each element of x{1,1} and multiply it with corresponding values of y{1,1} and add them. When it comes to x{2,1}, it will be multiplied with y{2,1}.
Please suggest any efficient way of doing this without using multiple loops. Thank You.

Best Answer

It is much easier to work with multi-dimensional arrays instead of nested cells. The cell arrays require loops for numerical operations, such that they are a bad choice, if you want to avoid loops. But you can convert the data:
Result = cell(size(x));
for k = 1:numel(x)
Result{k} = y{k} * cat(1, x{k}{:});
end
The actual calculation is a simple matrix multiplication.