Hi all, here is the buggy code:

```
cvx_begin
variables c x(13) Y(13,13,m);
expressions K(12,12) A_0(13,13) D(13,13) S(13,13);
minimize(c)
subject to
for i=1:m
S=S+Y(:,:,i);
end
for k=1:m
[Y(:,:,k) A(:,:,k);A(:,:,k) A_0]==semidefinite(26);
end
A_0==semidefinite(13);
C*A_0-S==semidefinite(13);
cvx_end
```

I omit the definition of A_0 and C for clarity. Whenever I run it (let’s call it ProgramA), it returns the following error:

```
Index exceeds matrix dimensions.
Error in cvxprob/eliminate (line 200)
n_save = nnz(sum(dbCA(:,ineqs~=0)~=0,1)==1+(dbCA(1,ineqs~=0)~=0));
Error in cvxprob/solve (line 17)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );
Error in cvx_end (line 79)
solve( prob );
Error in ProgramA (line 65)
cvx_end
```

Please do believe me that the third dimension of A(:,:, is m (ie. there are really m A(:,:,i)). I found a weird thing. If in the for loop wrapping the semidefinite constraints, the upper index is reduced to m-1 from m, or if I delete the constraint “C*A_0-S==semidefinite(13);”, then it runs normally.

Thanks in advance for any possible answer.