Undefined operator '+' for input arguments of type 'cell'
1 次查看(过去 30 天)
显示 更早的评论
sum(k)={0};
for j=1:K
for i=1:K
if(j~=i)
sum(j)=(sum(j))+(f(i))
end
end
end
2 个评论
Walter Roberson
2018-2-14
Why are you initializing sum(k)={0}; instead of sum(k)=0 ? Are you expecting f(i) to return matrices of different sizes according to i? (If so then it is not clear what it would mean to add those.)
Walter Roberson
2018-2-14
About 2 1/2 weeks from now, you are going to try to use the function sum and then get very confused by an error message about indices needing to be positive integers or logical.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!