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
    조회 수: 3 (최근 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!

