I have K matrices where all of them are M*M and symmetric semidefinite. How I can define these matrices as cvx variables using a loop?

For K=3, I use this:

variable w1( M ,M) symmetric semidefinite

variable w2( M ,M) symmetric semidefinite

variable w3( M ,M) symmetric semidefinite

But I would love to do this in a loop like:

for k=1:K

W{k} == variable(M ,M) symmetric semidefinite;

end

However, Tthis is not valid in Matlab!

Could anybody help me please? Thanks!

The problem is every time I change the value of K in my matlab code, I need to change w1â€¦wK! Many thanks in advance!