bucket sort on cell array of vectors

hi guys,
i need your help in solving the following problem:
Given a cell array of vectors, sort them in a bucket sort manner.
Here is an example to ease the question:
thanks in advance.

 Réponse acceptée

Guillaume
Guillaume le 2 Déc 2015
Modifié(e) : Guillaume le 2 Déc 2015
c1 = {[1 2] [10 11];[2 3] [10 11];[1 2] [11 12]; [2 3] [11 12]};
c2 = table2cell(sortrows(cell2table(c1)))
Note that you haven't defined in the question how you order vectors. The above uses lexicographical ordering.
It's unfortunate that sortrows on cell array only work with scalar cell (unless the cells are all of type char), hence the conversion to table and back.

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by