How to solve this error" cvx_end " solve( prob );

That error message is suggestive of some kind of screwed up CVX installation or corrupted session.

What is the result of cvx_version. If it is CVX 3.0beta, do not use it, and follow the instructions at CVX 3.0beta is riddled with bugs, which are very unlikely to ever be fixed. Use the latest build of CVX 2.2

Otherwise, try a new MATLAB session.

If that doesn’t work try reinstalling CVX 2.2 in a new MATLAB session.

If that doesn’t work try rebooting.

If that doesn’t work, I’m out of ideas.