%
%  plot_histogram_random.m  ver 1.0  December 11, 2013
%
function[fig_num]=plot_histogram_random(y,fig_num,idis)
%
while(1)
    if(idis==6)
       out1=sprintf(' Enter the number of bars (suggest=%d)  ',(max(y)-min(y)));
       disp(out1);
       nbar=input(' ');
    else
       nbar=input(' Enter the number of bars ');
    end  
%   
    figure(fig_num);
    fig_num=fig_num+1;
    hist(y,nbar)
    ylabel('Counts');
    xlabel('Amplitude');  
    title(' Histogram '); 
    disp(' Re-plot with different number of bars? ');
    disp(' 1=yes  2=no ');
    irp=input(' ');
    if(irp==2)
       break;
    end
end
