title: From data to probability mass function - Matlab
body: <p>Is there a Matlab function which builds up the exact probability mass function (or probability density function) given a vector of data? </p>
  
  <p>I mean something like this:</p>
  
  <pre><code>X = [1 2 4 1 4 3 2 3 4 1];
  [x px] = a_function(X)
  x = 
     1 2 3 4
  px = 
     0.3 0.2 0.2 0.3
  </code></pre>