how to sort cells by date?
조회 수: 5 (최근 30일)
이전 댓글 표시
i have a column of dates DD\MM\YYYY, i want to sort them by date .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148378/image.jpeg)
i try:
sort(A);
but it sorts them by days
how i can do this?
댓글 수: 2
답변 (1개)
Walter Roberson
2015년 8월 24일
[~, order] = datenum(A(:,1));
sortedA = A(order,:);
댓글 수: 3
Walter Roberson
2015년 8월 24일
편집: Walter Roberson
2015년 8월 24일
[~, order] = sort(datenum(A(:,1)));
sortedA = A(order,:);
참고 항목
카테고리
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!