# How to distinguish "define" or "constraint "

Hello, everyone, some problems rises in my cvx code. So I want to seek some advice.
The details are that I want to define a auxiliary variable to easily realize the summary. But the
error messages express that I need to replace the “=” term with “==” to achieve the equality constraint.
The complete code is shown below

``````function s=GroupSparse_cvx(z,phi,block_num,ebisilon)
[row,col]=size(phi);
N=col/block_num;
M=row/block_num;
phi_block=zeros(M,N,block_num);
z_block=zeros(M,block_num);
for nn=1:block_num
phi_block(:,:,nn)=phi((nn-1)*M+1:nn*M,(nn-1)*N+1:nn*N);
z_block(:,nn)=z((nn-1)*M+1:nn*M);
end
cvx_begin sdp
variable S(N,block_num) complex
variable data_error(block_num,1)
for mm=1:block_num
data_error(mm)=norm(z_block(:,mm)-phi_block(:,:,mm)*S(:,mm));
end
minimize norms(S,2,1)
subject to
sum(data_error)<=ebisilon;
cvx_end

s=reshape(S.',[],1);
end
``````

And the error message is

``````The following cvx variable(s) have been cleared or overwritten:
data_error
This is often an indication that an equality constraint was
written with one equals '=' instead of two '=='. The model
must be rewritten before cvx can proceed.

``````

You probably want `data_error` to be an `expression`, not a `variable`. A `variable` is an actual optimization variable, part of your mathematical optimization model. (In particular you could never make it equal to a norm, since that would be a nonconvex constraint.) An `expression` is a temporary placeholder in Matlab code to hold auxiliary expressions for later use.