The most straightforward way to create a cumulative distribution from data is to generate an empirical CDF. The ecdf
can do this directly. By default, this doesn't require one to produce a histogram for a dataset:
x = randn(1000,1);
ecdf(x);

However, if you want a lower resolution CDF, you can use histogram
directly with the 'cdf'
normalization option:
x = randn(1000,1);
nbins = 25;
histogram(x,nbins,'Normalization','cdf');

You might find the 'cumcount'
option useful too. See the documentation for ecdf
and histogram
for details on how to extract and use the output from these functions.