function  q = myquantile(data, p)
% Input: data - data vector,  p-desired probability in (0,1)
% Output:  q - sample quantile
% Example of use
%  > dat=randn(1,10000);
% >  myquantile(dat, 0.975)
% 
sorteddata = sort(data(:));
n = length(sorteddata);
q =  sorteddata(ceil( p * n ));

