The expression to the left of the equals sign is not a valid target for an assignment - MATLAB
===

   My code is given below i get this error : The expression to the left of the equals sign is not a valid target for an assignment.

It points to "Temp1(i) = ( ( X(i,1)*theta(i,1) + X(i,2)*theta(i,2) ) - y(i));"

I dont understand what is wrong here. Please help


    Temp1 = zeros(m);
    sum1 = 0;
    for i = 1:1:m
    {
        Temp1(i) = ( ( X(i,1)*theta(i,1) + X(i,2)*theta(i,2) ) - y(i));

        sum1 = sum1 + (Temp1(i)^2);
    }
    
    
    J = sum1 / (2*m);

    fprintf(' The value of J = ');
    fprintf('%f', J);
 
    return J; 