How to express constrain in CVX?

Apparently, you have not done something correctly, but unless you provide the requested information, readers of the forum will not be able to provide more specific guidance.

I use Matlab R2016a and R2018a respectively to run the same code, optimization value is not the same. I’m confused.

Does CVX claim to have solved both problem to optimality? is the optimal objective value the same (within tolerance)?

Please show us the code, preferably with all input data, and the solver and CVX output which shows what you are saying.

For examlpe:
chosed_list = [a1 b1 c1 d1;a2 b2 c2 d2];
variable A(size(chosed_list)) binary
Constrain:B == sum(A.*chosed_list,2);
sum(A,2) == 1;
I suppose that the optional value is (b1;b2);but when I use “B == (a1;a2)”,the objective value is better.

You haven’t shown us a complete program, including an objective function. If there is no objective function, any feasible solution is as good as any other.