Ege - It isn't obvious to me what is wrong with your code. In fact, if I copy and paste it into a sample ...
www.mathworks.com