Solving for diagonal matrix via SDP

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' ) )

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, );

Error in cvx_finish

Error in cvx_end (line 11)
_ evalin( ‘caller’, ‘cvx_finish’ );_

Do you have a typo? Is that supposed to be B = fft(eye(n)); ? If so, it solves without error message for me.

Please show the complete output of cvx_version. I think either you must be using CVV 3,0BETA, in which case you should switch to CVX 2.1, or your CVX installation is not correct (i.e., is screwed up).

Also, I suggest you not use the quiet option until you are sure your program is working correctly, which obviously it is not for you as of now.

Thanks for the reply. I was using the beta version. Problem is fixed after I switched to CVX 2.1.