All dimensions but the one being concatenated (1) must be equal

i have error in cvx code with minimize the energy consumpution in NOMA enabled MEC system, my code is
variable l1(1,K)
variable p(1,K)
variable Rt(1,K)
variable Rs(1,K)
variable phi(1,K)
variable u(1,K)
variable pai(1,K)
variable w(1,K)
variable B(K,K)
variable b(1,K)
expression m(1,K-1)
expression c1(1,K-1)
%objective function
E = zetapow_abs(c,3)pow_abs(l1,3)./0.01 + p.T;
a1 = sum(sum(B-B1+rou.
a2 = sum(sum(B.
a3 = sum(sum(B+B’- ones(K) + eye(K) +rou.* lam3));
fun = sum(E) - 0.5rou(a1 + a2 - a3);
minimize (fun)

        subject to
        for k = 1:K
           (L(i) - l1(k))-10^5* Rs(k)<=0; 
           Rt(k) - log(1+b(k))<=0;
           b_old(k)*pai_old(k) + pai_old(k)*(b(k)-b_old(k))+b_old(k)*(pai(k)-pai_old(k))- gamma(k)*p(k)<=0;
           exp(-phi(k)*pow_abs(d,alpha)) <= epsilon;
           p_old(k)*u_old(k) + u_old(k)*(p(k)-p_old(k))+p_old(k)*(u(k)-u_old(k))- w(k)<=0;
           phi_old(k)*w_old(k) + w_old(k)*(phi(k)-phi_old(k))+phi_old(k)*(w(k)-w_old(k))- (pai(k)+gamma(k)*p(k)-u(k))*10^-7<=0; 
          for l = 1:K
               if l~=k  
                  m(l) = (B_old(k,l)-gamma(l).*p_old(l))*(B(k,l)-gamma(l).*p(l))*0.25-square(B_old(k,l)-gamma(l).*p_old(l))*0.125;
                  c1(l) = B(k,l)-p(l);
               elseif  B_old(k,l)~=0
                 gamma(l)*(B_old(k,l)*p_old(k) + p_old(k)*(B(k,l)-B_old(k))+B_old(k)*(p(k)-p_old(k)))<=gamma(k).* p(k); 
           norm([sum(m)+(pai(k)-1)*0.5 -0.5;c1(1)*0.5;c1(2)*0.5])<=(pai(k)-1)*0.5+0.5+sum(m);

there is an error in NOMA decoding order
错误使用 cvx/cat (line 40)
All dimensions but the one being concatenated (1) must be equal.

出错 cvx/vertcat (line 6)
y = cat( 1, varargin{:} );

出错 penalty (line 101)

how to solve the problem?

Just before the line producing the error is reached, type one element, per command line, of the norm argument, and hit Enter. That should show you the dimensions of each element. They need to be conformal per the standard MATLAB rules so that they can be concatenated into the argument for norm.

i used this method , the elements all the scalar
cvx real affine expression (scalar)
but still has the error

Can you choose a small value of K and post a complete reproducible problem?

i’m sorry i didn’t see the message until now. i want to solve the decoding order in NOMA system. now the c1 vector is 1×3, but one element in c1 is cvx zero expression (scalar). how to remove the zero element and make c1 be a 1×2 vector?
and if the c1(1) is the zero element, can be such an error like All dimensions but the one being concatenated (1) must be equal?

If c1 is 1 by 3, then c1(2:3) is 1 by 2 and has “eliminated” c1(1). Does that answer your question? This works whether c1 is a MATLAB variable, a CVX variable, or a CVX expression.

thanks professor, i solved this problem。but there is another error。

错误使用 cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {concave} <= {constant}

出错 <= (line 21)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘[]’ ), x, y, ‘<=’ );

出错 penalty (line 92)

i debug it find that it is correct in first two loops, but when doing the third loop the code has the error.

this constraint is %E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20200527092558
then i use SCA method so the constraint rewriten as

I presume the sign of some coefficient(s) must change to make the LHS concave instead of coovex in the 3rd loop. You should examine the values of the coefficients in each loop. perhaps you need some type of safeguard to prevent this. This kind of thing (unsafeguarded changes to variables from one iteration to the next) is one of the reasons I am not a big fan of crude SCA methods instead of using a high quality safeguarded non-convex nonlinear optimizer.

For the record, I’m not a professor. Just what we call in the U.S., an ordinary Joe

thank you very much, i will examine the value carefully.