How can I sort cell arrays along with vectors?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
dormant
am 4 Jan. 2024
Kommentiert: dormant
am 5 Jan. 2024
I am getting very confused by all the documentation on sorting in MATLAB, so can someone please answer this very specific question?
I have a number of numeric vectors along with two associated cell arrays, ie
How can I sort them all together with the order defined by one of the numeric vectors?
3 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Jan. 2024
[~, SortOrder] = sort(vtstring_datim_begs); %or as appropriate
s_ends = vtstring_datim_ends(SortOrder);
s_durs = vtstring_durs(SortOrder);
s_ids = vtstring_ids(SortOrder);
s_max_MLs = vtstring_max_MLs(SortOrder);
%and so on
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!