hi, i have this code a error "The expression to the left of the equals sign is not a valid target for an assignment." Please help me to understand, since the function can be execute outside the while loop. However, its return the error when run inside the while loop.
data = readtable('DATA3.txt');objec_func = 0;%no of cluster
k = 4;%set initial centroid
c1 = [13 25 15 11 11 14 12 12 10 14];c2 = [13 25 14 11 11 14 12 13 13 13];c3 = [13 24 14 10 11 14 12 12 12 15];c4 = [13 25 14 11 11 13 12 12 12 13];%calculate distance
distance=d_euclidean(data,c1,c2,c3,c4); %partition_matrix
pm = p_matrix(distance) %objective function
objective = obj_function(distance,pm)%calculate mean
[cc1,cc2,cc3,cc4] = calc_centroid(data)%calculate distancedistance2=d_euclidean(data,cc1,cc2,cc3,cc4); %partition_matrix pm2 = p_matrix(distance2) %objective function objective2 = obj_function(distance2,pm2) while(objective2 < objective) { [cc1,cc2,cc3,cc4] = calc_centroid(data) %the error come from this line
distance2=d_euclidean(data,cc1,cc2,cc3,cc4); pm2 = p_matrix(distance2) objective2 = obj_function(distance2,pm2) }
Best Answer