I am trying to do the following in MATLAB,

n = 4;

A = randn(n,n);

B = ftt(eye(n));

```
cvx_begin sdp quiet
variable P(n,n) diagonal
minimize( norm( A - B*P*B' ) )
cvx_end
```

I get the following error. Can you please help me fix this?

*Array indices must be positive integers or logical values.*

*Error in cvx_extract (line 552)*

_ Pd(Pr) = false;_

*Error in cvx_solve (line 26)*

*[ At, cones, sgn, Q, P, exps, dualized ] = cvx_extract( shim.config, shim.name );*

*Error in cvx_finish*

*Error in cvx_end (line 11)*

_ evalin( ‘caller’, ‘cvx_finish’ );_