I need help arranging two vectors
조회 수: 4 (최근 30일)
이전 댓글 표시
Suppose I have an area vector, composed of two vectors, length and width multiplied together. If I arrange the area from low to high how can I arrange my vector of length and width to match the entries used in the newly arranged area vector. Example: Area(1) = 200, Length(1) = 100, Width(1) = 2, after I sort vector Area, Area(1) moves to Area(3), how do I move Length(1) to Length(3) and also Width(1) to Width(3). Note, my array has 5000 entries.
댓글 수: 0
답변 (2개)
David Young
2015년 3월 15일
[AreaSorted, idx] = sort(Area);
LengthSorted = Length(idx);
WidthSorted = Width(idx);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!