This is a very bad model (nonlinear equality)
G = sdpvar(2);
P =
[0 sdpvar(1);sdpvar(1) 0];
optimize([G == P'*P],trace(G))
This is a very simple problem (convex QP)
P = [0
sdpvar(1);sdpvar(1) 0];
G = P'*P;
optimize([],trace(G))
I fear you are doing something along the lines of the first case
G=[sdpvar(1) 0;0 sdpvar(1)];
Objective=G(1,1);
Constraints=[0<=G(1,1)<=1];
Constraints=[Constraints,0<=G(2,2)];
a=optimize(Constraints,-Objective);
P=[sdpvar(1) 0;0 sdpvar(1)];
G_=P'*P;
Objective_=[1,0]*G_*[1;0];
Constraints_=[0<=[1,0]*G_*[1;0]<=1];
Constraints_=[Constraints_,0<=[0,1]*G_*[0;1]];
b=solvesdp(Constraints_,-Objective_);
Second one always return zero solution,G_=[0 0; 0 0] and P=[Na 0;0 Na].