I know there has got to be a cleaner more elegant way to do this. I have an array of number in the range [0,1] and want to check which ones are greater than a threshold. I remember there being some syntax to do this nicely. In python I would use something like a lambda function.
p = sigmoid(dot(theta,X));
for i =1:size(p)
if(p(i)>=0.5)
p(i)=1
else
p(i)=0
end
end
mtrw is on the right track, but it gets even shorter: