I have a matrix of lets say n variables. Very few of them have to be integer and equal between them. I am a bit stack because till now I have not used a matrix with mixed values, only full integers or no integers. Can this be done somehow with the integer keyword? Is there an elegant way to do it? I tried: variable UVW(length(X),3); variable UVW(Ufirst,1) integer; variable UVW(Vfirst,2) integer; variable UVW(Wfirst,3) integer;

But of course I get the error: Duplicate variable name: UVW.

Just concatenating them as you did ruins the order though. Lets make up a scenario. Suppose you have :

cvx_begin
variable x(10)

And we need the first and the fifth to be integer. Appending the two integer ones at the end means we somehow have to rearrange them. Creating a new matrix of indices might solve this, but it is definitively not that elegant. Any suggestion? I did not probably make the problem clear in the initial question.