Undefined operator '+' for input arguments of type 'cell'

1 Ansicht (letzte 30 Tage)
VISHALI V
VISHALI V am 14 Feb. 2018
Kommentiert: Walter Roberson am 14 Feb. 2018
sum(k)={0};
for j=1:K
for i=1:K
if(j~=i)
sum(j)=(sum(j))+(f(i))
end
end
end
  2 Kommentare
Walter Roberson
Walter Roberson am 14 Feb. 2018
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
Walter Roberson am 14 Feb. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by