Multiply two cell arrays
显示 更早的评论
Hi i have following two cell arrays mul1 and mul2.
I want to multiply each cell of mul1 with corresponding cell of mul2. I am using following code
for i=8
for j=7
mul3{i,j}= mul1{i,j}.*mul2{i,j};
end
end
but it gives error:
Error using .*
Matrix dimensions must agree.
i also tried without using loop but still same issue.
Please help
3 个评论
Stephen23
2018-2-28
@lucksBi: your title and question are both incorrect: it is not possible to multiply cell arrays, and this is not what you are doing. What your code actually does is multiply some (presumably numeric) arrays that happen to be stored in the cells of a cell array. The error you are getting is because they have incompatible sizes, so please tell us what the sizes are when the error occurs:
size(mul1{i,j})
size(mul2{i,j})
lucksBi
2018-2-28
Stephen23
2018-2-28
lucksBi: I did not ask you for the size of mul1 or mul2. Please read my comment again.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!