I'm using Matlab and have created a histogram and want a vertical line to indicate the mean. So far my code is
N=100;
mydata=rand(N,1);
mymean=mean(mydata);
histogram(mydata);
figure(1)
hold on
line(mymean,N,'r')
I expect to find a red line crossing the x-axis at the mean value, but there is no line plotted. What is wrong here?