MATLAB: How to multiple the element of cell of array with different size

multiple the element of cell of array with different size

I have these array and I want to multiple each element of each cell.
A={1.70100628697192 [1.69602683977168;1.70100628697192;1.70553113530920] [1.69104739257145;1.69602683977168;1.70100628697192;1.70553113530920;1.70732905110288]}
B={3.18309886183791 [1.83776298473932;1.59154943091895;1.83776298473932] [1.42352508683433;1.12539539519637;1.06103295394597;1.12539539519637;1.42352508683433]}
I want to have C like this:
C={5.4145 [3.1169;2.7072;3.1344] [2.4072;1.9087;1.8048; 1.9194; 2.4304]}
How can I do this?

Best Answer

>> C = cellfun(@times, A, B, 'UniformOutput',false);
>> C{:}
ans = 5.4145
ans =
3.1169
2.7072
3.1344
ans =
2.4072
1.9087
1.8048
1.9194
2.4304