title: How can I remove duplicates in an array but keep the same order?
body: <p>I have this cell array in MATLAB:</p>
  
  <pre><code>y = { 'd' 'f' 'a' 'g' 'g' 'a' 'w' 'h'}
  </code></pre>
  
  <p>I use <code>unique(y)</code> to get rid of the duplicates but it rearranges the strings in alphabetical order:</p>
  
  <pre><code>&gt;&gt; unique(y)
  
  ans =
  
  'a'    'd'    'f'    'g'    'h'    'w'
  </code></pre>
  
  <p>I want to remove the duplicates but keep the same order. I know I could write a function do do this but was wondering if there was a simpler way using <code>unique</code> to remove duplicates while keeping the same order just with the duplicates removed.</p>
  
  <p>I want it to return this:</p>
  
  <pre><code>&gt;&gt; unique(y)
  
  ans = 
  
  'd'    'f'    'a'    'g'    'w'    'h'
  </code></pre>