how to sort a cell array inside a struct?
Show older comments
I have this struct and I have to sort every vector on the right side
T=table(string,ID_number);
[G, IDs] = findgroups(T.string);
C = splitapply(@(x){x},T.ID_number,G);
Name_Code = struct('name', cellstr(IDs), 'Code', C);

Accepted Answer
More Answers (1)
Jan
on 29 Jul 2021
Expand
C = splitapply(@(x) {x}, T.ID_number, G);
to
C = splitapply(@(x) {sort(x)}, T.ID_number, G);
Categories
Find more on Shifting and Sorting Matrices 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!