title: Speed up arrayfun
body: <p>I have a very large Matlab table of about 11 million rows, that I would like to rearrange to have an cell array for each instance of one of the variables. The following smaller data set will illustrate my problem:</p>
  
  <pre><code>Data = table(repmat(randperm(50).',200,1),rand(10000,1),'VariableNames',{'ID','VAR'});
  </code></pre>
  
  <p>I am able to perform the task by the following command, but it is quite slow when applied to my real table:</p>
  
  <pre><code>UniID = unique(Data.ID);
  
  CellData = arrayfun(@(x)Data(Data.ID==x,:),UniID,'UniformOutput',false);
  </code></pre>
  
  <p>What can I do to optimize the execution time?</p>