I have a date column staring from '31-Jul-2013 10:59:50' and ends on '04-May-2015 12:45:10'. the total no of. rows are 5547430(that means the data is collected for every 10 secs). I have another column of equal size of date column. Now I want to plot the collected Data in specific period of time. For example I want to plot the data in June 2014 or May 2015 or January 1st 2014. How to extract the content from data corresponding to specific date or time.

 채택된 답변

Peter Perkins
Peter Perkins 2015년 10월 1일

0 개 추천

In R2014b or later, try this:
d = ( datetime('31-Jul-2013 10:59:50'):seconds(10):datetime('04-May-2015 12:45:10') )';
x = cumsum(randn(size(d)));
isJun2014 = isbetween(d,'1-Jun-2014','1-Jul-2014');
plot(d(isJun2014),x(isJun2014))

댓글 수: 1

Thanq Peter perkins :) I have found some time taking solution. This one gives direct access to date column. Thanq :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Kirby Fears
Kirby Fears 2015년 9월 30일
편집: Kirby Fears 2015년 9월 30일

0 개 추천

Just about every question about date/time in Matlab has been asked and answered on the internet. Try searching this website or Google to get the answers you need. To get you started, I have a summary below.
You can convert your string dates to serial date numbers using datenum () by specifying your date format. Dates in numeric format are easy to compare to each other. In plots, the date numbers on the X axis can be displayed as date strings using datetick () and specifying a format.
Alternatively you can turn your dates and values into a time series object .

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by