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!