How to change the number of variables based on the iteration number?

Why not use multidimensional arrays? For instance:

variable Q_1(n,n,k) hermitian;
variable Q_2(n-1,n-1,k) hermitian;

Then you can access an individual ‘slice’ with colon notation; e.g., Q_1(:,:,k).

From the documentation:

Matrix-specific keywords can be
applied to n-dimensional arrays as
well: each 2-dimensional “slice” of
the array is given the stated
structure. So for instance, the
declaration

variable R(10,10,8) hermitian semidefinite

constructs 8 10×10
complex Hermitian PSD matrices, stored
in the 2-D slices of R.