Arrange cell content in a specific order

2 views (last 30 days)
Hi all,
I've two variables:
> FILE_NAME with the subject ID (for example S122_JEMO) and the condition (from 40C_1 to 65C_4).
> Ankle_Angle, the cells are in the same order as FILE_NAME. e.g. Ankle_Angle{1,1} belongs to FILE_NAME{1,1}
My goal is to arrange these two cell contents from the lowest subject ID to the highest one (i.e. S2, then S15, S122, S129 and S140).
My work is quite urgent and I've really no idea to do that...
THANKS a lot in advance !!

Accepted Answer

Stephen23 on 2 Mar 2021
Edited: Stephen23 on 3 Mar 2021
One easy solution is to download my FEX submission natsortfiles:
Unzip it onto the MATLAB search path (e.g. the current folder), and then use it like this:
[sortedFN,idx] = natsortfiles(FILE_NAME);
sortedAA = Ankle_Angle(idx);
  1 Comment
Louise on 2 Mar 2021
It works very well !
Thanks a lot !

Sign in to comment.

More Answers (0)


Find more on Files and Folders in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!