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 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2018-4-20
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!