y = sum(c)
y = 0;for i = 1:length(c);y = y + c(i);end
y = 0;for i = 1:length(x);y = y + c(x(i));end
y = sum(c(x))
y = sum(c(x))
>> y = 1;>> sdpvar x>> y(x)
Function 'subsindex' is not defined for values of class 'sdpvar'.
d = binvar(10,1);
for i=1:length(vx);
Constraints = [Constraints,implies(d(i),t(i,:)==(squeeze(aux(1,vx(i),i,:))))'];
end
%solve the problem
ops = sdpsettings( 'solver','Cplex');
Objective1=(sum(norm(demandeg(1:168)+t1./5-(sum(demandeg(1:168)+t1./5))/168),2))/168;
sol1 = optimize(Constraints,Objective1,ops);
vx2=value(vx);
opt1=value(Objective1);
evnumberwd0=200;
vx = intvar(evnumberwd0,1);
t=sdpvar(168,evnumberwd0);
c=cell(evnumberwd0,1);
for i = 1:200;
c{i} = binvar(num(1,i),1);
end
i=1;
Constraints = [t(:,1) == (temp0loadyear1{1,1}(169:336,:))*c{1}, vx(1) == (1:num(1,1))*c{1}, sum(c{1})==1];
for i=2:200
Constraints = [Constraints,t(:,i) == (temp0loadyear1{1,i}(169:336,:))*c{i}, vx(i) == (1:num(1,i))*c{i}, sum(c{i})==1];
end
t1=sum(t,2);
ops = sdpsettings( 'solver','mosek');
%solve the problem