From Spinach Documentation Wiki
A simple 1D bin packing algorithm.
Collects the list of numbers supplied into sublists that sum to the number that is smaller or equal to the number specified. The algorithm is not optimal, but it does the job.
box_sizes - a row vector of box sizes bin_size - an integer specifying the bin size
bins - a cell array of index vectors specifying boxes allocated into each bin
Version 2.1, authors: Ilya Kuprov