Cannot use a value of type struct as an index

This is my first time using CVX with Gurobi to solve a problem.And I want to see how it works with a simple example. The following is the example that I am trying:

% Matlab code
    variable x(1)
    minimize( x(1) )
    subject to

However, I got the error ‘Cannot use a value of type struct as an index.’, and additional info is as followed:

Calling Gurobi 9.00: 1 variables, 1 equality constraints
Status: Error
Optimal value (cvx_optval): NaN

Cannot use a value of type struct as an index.

Error cvxprob/solve (line 435)
             [x, status, tprec, iters] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

Error cvx_end (line 88)
         solve( prob );

Error ArrayDesignTst (line 51)

Is there any way to fix this issue? Thanks!

Does this execute without error using a different solver than Gurobi?

There may be some bugs in the Gurobi-CVX interface.

My only suggestions: Use CVX 2.2, not CVX 3.0beta. Try reinstalling CVX. Try a fresh MATLAB session. Try a different (more recent) version of Gurobi.

I restarted my Matlab2020a and tried four solvers, and this example worked well with all solver except Gurobi. So i think maybe there is some bug in the CVX-Gurobi interface.By the way, I’m using the standard CVX2.2.But i dont know whether latest version of Gurobi fits the CVX, cause when i install a Gurobi license, the grbkey version is 9.0.0