Sort tables within a cell by size

2 Ansichten (letzte 30 Tage)
Lutetium
Lutetium am 8 Mär. 2021
Bearbeitet: Jan am 9 Mär. 2021
I'm struggling a bit to sort several timetable according to their length. Can someone help me to get the right syntax?
I appreciate the input

Akzeptierte Antwort

Jan
Jan am 8 Mär. 2021
Bearbeitet: Jan am 9 Mär. 2021
Try this - I cannot check it, because I do not have your input data:
Len = cellfun(@height, C); % [EDITED] @length -> @height
[~, index] = sort(Len);
C = C(index);
  1 Kommentar
Lutetium
Lutetium am 8 Mär. 2021
thanks, works perfectly! just had to replace length by height since its a timetable
I appreciate your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by