values = {a, b, c, d}; lens = cellfun(@length, values); [~, idx] = sort(lens, 'descend'); out = [values{idx}];
how can I link 4 vectors based on their length? that is from the longest to the shortest
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lotmeri
am 20 Apr. 2018
Beantwortet: Walter Roberson
am 20 Apr. 2018
I.e.
I have a=[5 5 5 5 5], b=[4 4 4 4], c=[3 3 3] and d=[2 2].
I want to concatenate out=[a b c d] without knowing, however, the length of a, b, c, d in each cycle.
Thank you.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 20 Apr. 2018
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating 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!