sparse(A) does not accept char inputs A

The rather confusing error message is because you used cvx begin . You should use cvx_begin.

Also, you need to use cvx_end , not cvx end .

If you look several topics down the forum, you will see Error using sparse. sparse(A) does not accept char inputs A , which is the very same issue.