CVX - Gurobi: how to know which model is being solved?

Is there a way to print the model which is being passed to Gurobi after “meta-modeling” by CVX? I.e., is there a way to print out the objective function vector and all the constraints of the Gurobi model inferred from the CVX model?

Sure, see the online help for cvx_solver_settings, specifically the dumpfile command. That will give you the input that CVX feeds to Gurobi and the output the solver generates. For example, this will cause CVX to create a file containing test.mat containing all sorts of useful information. We use it periodically for debugging purposes.

cvx_solver gurobi
cvx_solver_settings( 'dumpfile', 'test' )

Inputting this and running the code generates:

Number of field names must match number of fields in new structure.

Please consider submitting a bug report; we don’t get that error here. (And do make sure you have the latest version of CVX before you do.)