Semidefinite Optimization with Linear Constraint

You can use for loops to define constraints and if necessary, build up objective functions. You can also declare 3-D CVX variables, e.g., cvx variable X(2,2,n) symmetric . Then you can use such things as X(:,:,i) … See for instance mcg’s answer in Cvx sdp mode and cell arrays .

And of course, trace is supported by CVX.