Is this possible for Assignment: Trace(M1_n*X) == Trace(M2_n*X)?

Do you actually have variables literally named M1_n and M2_n? I’m not talking about having variables named M1_1 , M1_2, etc. If not, I think your for loop

for n=1:N
trace(M1_n*X)==trace(M2_n*X);
end 

would generate an error message, and therefore be “ignored” by CVX, i.e., it would never be part of the CVX model you create. And if you do have variables literally named M1_n and M2_n, you have specified the constraint trace(M1_n*X)==trace(M2_n*X) N times, which is equivalent to specifying it once. And then it’s a matter of whether the solver can successfully solve the problem, or whether it encounters numerical difficulties or an error condition.

Have you tried using sedumi, or if you have CVX Professional and MOSEK, using MOSEK?

Perhaps you should put M1_1, … M1_N all into one 3 dimensional array, M1 with 3rd dimension of length N. And similarly for M2_1, …, M2_N. See mcg’s answer in How to change the number of variables based on the iteration number? .