multiply correspond element in cell arrays

13 views (last 30 days)
Hi everybody
I have 2 cell arrays a and b, how could I multiplying together their correspond elements.
a =
Columns 1 through 4
[41x1 double] [319x1 double] [54x1 double] [355x1 double]
Column 5
[400x1 double]
b =
Columns 1 through 4
[41x1 double] [319x1 double] [54x1 double] [355x1 double]
Column 5
[400x1 double]
Thanks in advance

Accepted Answer

Guillaume
Guillaume on 21 Jan 2016
Use cellfun:
c = cellfun(@times, a, b, 'UniformOutput', false) %times is function name of .*
This will only work if all elements of the cell array are the same size AND the cell array are the same size.

More Answers (1)

Walter Roberson
Walter Roberson on 21 Jan 2016
Edited: Walter Roberson on 21 Jan 2016
cellfun(@times, a, b, 'Uniform', 0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!