How to return the smallest vector.
조회 수: 19 (최근 30일)
이전 댓글 표시
채택된 답변
Matt J
2020년 1월 17일
편집: Matt J
2020년 1월 17일
If you "have them" in cell array form, then you could do something like this:
>> vectors={[3 4 5],[1,2],[5 6 7 8]}
vectors =
1×3 cell array
{1×3 double} {1×2 double} {1×4 double}
>> [~,imin]=min(cellfun('length',vectors));
>> smallest=vectors{imin}
smallest =
1 2
댓글 수: 3
Image Analyst
2020년 1월 17일
Well, what form were they in? Just separate variables? If so, you need to check their lengths one at a time.
Matt J
2020년 1월 17일
Or, you will have to load them into a cell array manually,
vectors={v1,v2,v3,...}
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!