function Ctmp = WeightedDiscretePerfectCSIConst(Gamma,w,Eta,R) 
Rmat = zeros(size(Gamma));
for i = 2 : length(Eta)
  Rmat(Eta(i-1)<=Gamma&&Gamma<=Eta(i)) = 
end
[x,y] = find(Gamma>Et)
[WCtmp3,WCtmp3idx] = max(repmat(w,size(Gamma,1),1).*Cmat3,[],2);
linidx = sub2ind(size(Gamma),(1:size(Gamma,1))',WCtmp3idx);
Ctmp = zeros(size(Gamma));
Ctmp(linidx) = Cmat3(linidx);