MOSEK returns NaN although the optimization problem is solved

The problem was assessed to be infeasible. Therefore, the variables were populated with NaN.

Mosek warned about near zero and very large magnitude numbers, i.e., bad numerical scaling. Because of the bad scaling, results from Mosek or any other solver might be unreliable. You should choose different units, so that all non-zero input data is within a small number of orders of magnitude of 1. At least make sure there are no Mosek warnings; but you should strive to get scaling better than just not getting warnings.

Then re-run Mosek. if the result still is infeasible, follow the advice at Debugging infeasible models - YALMIP , all but section 1 of which also applies to CVX.