Sorry, I wasn’t paying attention to your doing gp. Without gp, my code would work.
If you are doing gp, I can’t think of a more elegant way than building up an expression which inserts the zeros where you want them. For instance, if you want a 6 by 1 vector with zeros in the 2nd and 5th components,
variables x y(2) z
P = [x;0;y;0;z]
I’ll leave you to work out the details in your case.
Perhaps someone else can provide a more elegant solution.