Sort tables within a cell by size

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

 Accepted Answer

Jan
Jan on 8 Mar 2021
Edited: Jan on 9 Mar 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 Comment

thanks, works perfectly! just had to replace length by height since its a timetable
I appreciate your help!

Sign in to comment.

More Answers (0)

Categories

Products

Tags

Asked:

on 8 Mar 2021

Edited:

Jan
on 9 Mar 2021

Community Treasure Hunt

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

Start Hunting!