Diagonal constraint

How to write the constraint “diag(A)=I”? I is the unit matrix and A is a n*n hermite semidefinite matrix.

diag(A) == 1 constrains all diagonal elements of A to 1. diag(A) == ones(n,1) does the same thing. Noe that == rather than = is needed for equality constraint.

Thank you very much!!!