how to sort cells by date?
이전 댓글 표시
i have a column of dates DD\MM\YYYY, i want to sort them by date .

i try:
sort(A);
but it sorts them by days
how i can do this?
댓글 수: 2
Walter Roberson
2015년 8월 24일
Is 11\5\2007 before or after 11/5/2007 ?
Amr Hashem
2015년 8월 24일
답변 (1개)
Walter Roberson
2015년 8월 24일
[~, order] = datenum(A(:,1));
sortedA = A(order,:);
댓글 수: 3
Amr Hashem
2015년 8월 24일
Walter Roberson
2015년 8월 24일
편집: Walter Roberson
2015년 8월 24일
[~, order] = sort(datenum(A(:,1)));
sortedA = A(order,:);
Amr Hashem
2015년 8월 24일
카테고리
도움말 센터 및 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!