Cvx2.1 version Error using * Inner matrix dimensions must agree

I checked all the matrix dimensions in my code, and found no errors. I also searched for relevant questions to answer. I installed the cvx2.1 version, but did not find the cvx2.2 version. I do not know where my code went wrong? Can someone help me? Thank you.
Error using *
Inner matrix dimensions must agree.
Error cvxprob/eliminate (line 137)
P = P * cvx_invert_structure( xR );

Error cvxprob/solve (line 18)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );

Error cvx_end (line 88)
solve( prob );

Error mec1 (line 125)
cvx_end

Download CVX 2.2 at http://cvxr.com/cvx/download/ .

Your error sounds like it is due to a CVX installation error (as is usually the case when the error occurs at cvx_end). (Re)install CVX 2.2 starting in a new MATLAB session. Do not use CVX 3.0beta. If you did use CVX 3.0beta, remove all CVX directories from your MATLAB path before installing CVX 2.2 It is a good idea to do that even if you never installed CVX 3.0beta.

What is the output of
cvx_version

    cvx_save_prefs
    cvx_begin
    cvx_solver mosek
    variable W(M,M,K)
    variables R(K,K) r(K)   relax_IN_VB(K,L) relax_S1_lamda(K,L) relax_S2_lamda(K,L)  tau_max(K)  gammaa(K,L)
    expressions    LMI_S1(M+N_all+1,M+N_all+1,K,L) LMI_S2(M+N_all+1,M+N_all+1,K,L);
    u=u_t;
    Theta=diag(u);
    epsilong=epsilong_rE+epsilong_BE;
    SEE=0;
    P=0;W_temp3=0;
    for k=1:K
        h_k(:,k)=h_Bk(:,k)+G'*Theta'*h_rk(:,k);
        H_k(:,:,k)=h_k(:,k)*h_k(:,k)';
        SSE=SEE+R(k,k)-tau_max(k);
    end
    for l=1:L
        W_temp2=0;
        E(:,l)=[h_rE(:,l)',h_BE(:,l)'];
        for k=1:K
            for s=k+1:K
                W_temp2=W_temp2+W(:,:,s);
            end
            A(:,:,k)=[Theta*G*W_temp2*G'*Theta',Theta*G*W_temp2;...
                W_temp2*G'*Theta',W_temp2];
            a(:,:,k,l)=A(:,:,k)+relax_S1_lamda(k,l)*eye(M+N_all);
            b(:,k,l)=A(:,:,k)'*E(:,l);
            c(k,l)=E(:,l)'*A(:,:,k)*E(:,l)+noise-gammaa(k,l)-relax_S1_lamda(k,l)*epsilong;
            LMI_S1(:,:,k,l)=[a(:,:,k,l)   b(:,k,l);...
                b(:,k,l)'    c(k,l)];
            right_up(k,l)=(exp(tau_max_t(k))-1)*gammaa(k,l)+gamma_t(k,l)*exp(tau_max_t(k))*...
                (tau_max(k)-tau_max_t(k));
            B(:,:,k)=[Theta*G*W(:,:,k)*G'*Theta',Theta*G*W(:,:,k);...
                W(:,:,k)*G'*Theta',W(:,:,k)];
            a0(:,:,k,l)=relax_S2_lamda(k,l)*eye(M+N_all)-B(:,:,k);
            b0(:,k,l)=-B(:,:,k)'*E(:,l);
            c0(k,l)=-E(:,l)'*B(:,:,k)*E(:,l)+right_up(k,l)-relax_S2_lamda(k,l)*epsilong;
            LMI_S2(:,:,k,l)=[a0(:,:,k,l)   b0(:,k,l);...
                b0(:,k,l)'    c0(k,l)];
        end
    end
    maximize SEE
    subject to
    for l=1:L
        for k=1:K
            LMI_S1(:,:,k,l) ==hermitian_semidefinite(M+N_all+1);
            LMI_S2(:,:,k,l) ==hermitian_semidefinite(M+N_all+1);
            relax_S1_lamda(k,l)>0;
            relax_S2_lamda(k,l)>0;
            P=P+trace(W(:,:,k));
            tau_max(k)*log2(exp(1))<=M_E;
        end
    end
    P<=P_max
    for j=2:K
        for s=j:K
            W_temp3=W_temp3+H_k(:,:,j)*W(:,:,s);
        end
        for k=1:j-1
            pow_pos((exp(R(j,k))-1)*real(A_t(j,k)),2)+pow_pos((real(trace(W_temp3)+noise))/real(A_t(j,k)),2)<=...
                2*real(trace(H_k(:,:,j)*W(:,:,k)));
            R(j,k)>R(k,k);
        end
    end
    cvx_end
     if cvx_status(1)=='S' || cvx_status(3)=='a'
         flag_w=1;
     else
         flag_w=0;
     end

Thank you for your answer. I still have this error after installing cvx2.2. Here is my code.It may be a little cumbersome. Thank you very much for helping me.
These are various parameter value dimensions.

You have not shown us the output of cvx_version .

Try a new MATLAB session. If that doesn’t fix it,. try rebooting your computer. if that doesn’t fix it, I’m out of suggestions.


The problem caused by the missing directory? What should I do

I think everyone is missing that directory, so not the problem.

You could try a different solver such as SDPT3 or SeDuMi and see what happens.

One thing I recommend is doing
cvx_solver Mosek_2
then
cvx_save_prefs .
That way the new version of Mosek will be used, not Mosek 9.1.9 which is included with CVX 2.2 Build 1148.

you solve this problem yet? I met the same problem like yours