When using CVX, we define multiple 1-dimensional variables a1,a2,…,a(n) by “variables a(n)”. I wonder how we do the same thing for 2 or higher-dimensional variables such as multiple 2 by 2 matrices. I tried:

for k = 1 : N

variable X(3,3,k) symmetric

end

It gave me error that multiple definition for X. Please feel free for any opinions.

# Multiple matrix variables definition

**jloveyy165**(Hyungjin Choi) #1

**Mark_L_Stone**(Mark L. Stone) #2

Don;t use a for loop.

See the answer by mcg at Semidefinite relaxations of quadratic constraint