Multiply two cell arrays
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 28 de Feb. de 2018
@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
el 28 de Feb. de 2018
Stephen23
el 28 de Feb. de 2018
lucksBi: I did not ask you for the size of mul1 or mul2. Please read my comment again.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!