However, I got the error ‘Cannot use a value of type struct as an index.’, and additional info is as followed:
error:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Error cvxprobe/solve (line 253)

[ x, status, tprec, iters2, y, z ] = shim.solve( [ At, Anew2 ], [ b ; bnew ], c, cones, true, prec, solv.settings, eargs{:} );

Error cvx_ End (line 88)

solve( prob );

Error precoding_ opt_ 1 (Line 190)

cvx_ end

Error main_ RSMA (line 57)

[r_all_pre1,p0,p1,p2]=precoding_ opt_ 1(q);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The code for the section is as follows：
for k=1:k_iter
cvx_begin
variable Rc_b1
variable Rc_b2
variable p0(N) complex
variable p1(N) complex
variable p2(N) complex
maximize(min(Rc_b1,Rc_b2)-Cc_b+R1_b-C1_b+R2_b-C2_b);
subject to
（Partial omission）
epsilon_c1>=exp(Rc_b1)-1;
cvx_end
p0_0=p0;
p1_0=p1;
p2_0=p2;
end

This looks like either a bug or a messed up installation or corrupted MATLAB session.

Things to try:

Try a different solver (use the cvx_solver command )

Try a new MATLAB session.

Try reinstalling CVX, and do that in a new MATLAB session. Make sure you are using CVX 2.2, Do NOT use CVX 3.0beta (it is riddled with bugs, which will likely never be fixed); and if you are using it, make sure to remove all CVX directories from the MATLAB path and save the MATLAB path; then install CVX 2.2 in a new MATLAB session.