char array comparison
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a large char array and these are dates so the array has elements as: 20070801 20070802 20070803 etc.
This array shows up as 100x8 in the workspace. I want to get all the dates which are less than 20070915. How do I use the 'find' function to achieve this or any other straight forward method?
댓글 수: 0
채택된 답변
Paulo Silva
2011년 3월 15일
a=['20070801';'20070802';'20070803']; %some date values
b=20070802; %value to compare
a(find(str2num(a)<b),:) %date values older than the compared value
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2011년 3월 15일
You could datenum() the dates and compare them to datenum() of your search date.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!