Collect Matlab data into a cell array based on a grouping variable