invalid is probably due to an input having value NaN. Sometimes this occurs due to using CVX in a loop (e.g., SCA) in which the optimal variable value from one CVX problem is used as or transformed into input data for the next CVX problem; but the first CVX problem was not solved successfully (infeasible, unbounded, or solver numerical difficulty), which causes CVX to populate variable values with NaN.

Does this happen on the first CVX problem you are solving? If so, look at the value of all the input data in the line of code which triggers the error message. I think at least one item will be NaN.You need to make all input be numbers. NaN is not allowed by CVX. What is the minimum of x^2 + NaN*x? That doesn’t make any more sense to CVX than it does to you.

If the first CVX problem is accepted, but does not find optimum, and hence produces NaN for optimal variable values, you need to “debug” why the problem did not successfully solve. The first thing is to look (and post) the solver and CVX output.