# How to solve this error with cvx_end

C = cost(av(1:m,:)‘,bv(1:m,:)’,cbeta);
n = 3*N + 6;
cvx_begin % sdp
cvx_solver mosek
variable X(n,n) symmetric
minimize( trace(C * X) ) %
subject to
X == semidefinite(n);
% trace(X((1:4),(1:4))) == 1;
X(1:3,1:3)==eye(3);
X(4:6,4:6)==eye(3);
for k=1:N
idx = 6+blkIndices(k,3);
% X(idx,idx) == X((1:4),(1:4));
X(idx,idx) == eye(3);
X(4:6,idx)==([1;0;0;]'X(4:6,idx)[1;0;0;])*eye(3);
norm(X(1:3,4:6)-X(1:3,idx))<=1-[1;0;0;]'X(4:6,idx)[1;0;0;];
norm(X(1:3,4:6)+X(1:3,idx))<=1+[1;0;0;]'X(4:6,idx)[1;0;0;];
end
for k1=1:N
for k2=k1+1:N
idx1 = 6+blkIndices(k1,3);
idx2 = 6+blkIndices(k2,3);
norm(X(1:3,idx1)+X(1:3,idx2))<=1+[1;0;0;]'X(idx1,idx2)[1;0;0;];
norm(X(1:3,idx1)-X(1:3,idx2))<=1-[1;0;0;]'X(idx1,idx2)[1;0;0;];
end
end
cvx_end

What is the output of `cvx_version`? Make sure you’re using CVX 2.2, not CVX 3.0beta, which is riddled with bugs.

If you are already using CVX 2.2., things to try:

1. different solver
2. fresh MATLAB session
3. reinstall CVX (in new MATLAB session)
4. reboot

Yes ,The version I use is 3.0 beta,The code already can run after I changed the 2.2 version,thanks!

Not only is CVX 3.0beta riddled with bugs, I believe it is very unlikely the bugs will ever be fixed and CVX 3.0 “released”. So everyone should just stick with CVX 2.2.