Error using cvx- An objective has already been supplied for this problem

I got the error statement : “Error using cvx.prob.newobj at 24- An objective has already been supplied for this problem” while trying to run my cvx program. However, If I comment out my objective function definition, the code runs successfully, I think as a feasibility problem.

Please help as I can’t seem to figure out the reason for the error message.

Have you tired doing this starting from a clean MATLAB and CVX session, where there is no doubt what has been entered?

It might help if you post your code.