CVX error:Conversion to double from cvx is not possible

Hi ALL,

I have a trouble. This my code

Blockquote
cvx_begin sdp
expression X_new(4,4,S,K)
variable Omega_new(S,K)

                sum_omega = sum(sum(SubcarrierAllocation_old .* Omega_new));
                
                minimize sum_omega
                subject to
                for k = 1:K
                    for s = 1:S
                        X_new(:,:,s,k) = [Omega_new(s,k)/2*eye(2)  eye(2); eye(2)  Power_old(s,k)*J_old(:,:,s,k)];
                        X_new(:,:,s,k) == semidefinite(4);
                    end
                end

J_old(:,:,s,k) is a 2*2 semidefinite matrix, Power_old(s,k) is a positive scalar. However, this error ‘Conversion to double from cvx is not possible’ occurs when another function

[M_s(k) = -lambda_k*log2(1+Power_Allocation_Strategy(s,k)*(abs(RISphase'*B_ks*T_ks))^2/N0) + Omega_new(s,k) + v] 

calls ‘Omega_new’. How can I correct it ? Thank you very much.

It is not clear from the description what the actual exact program flow is.

If the function is called from within your CVX program (after the variable declaration), the function should "know* (inherit) that is a CVX variable, and that expressions involving it are CVX expressions.

The error you received may occur when expression holders (arrays) are not declared or used properly. I don’t know what specifically is the reason for the error in your case. Perhaps M_s` needs to be declared as an expression holder, but isn’t?

Thank you Sir, I have solved the problem. I changed the version from 3.0 to 2.2, it’s OK.