필터 지우기
필터 지우기

mmyyy date to matlab date

조회 수: 2 (최근 30일)
V
V 2014년 8월 8일
편집: Sean de Wolski 2014년 8월 8일
Hi there.
I have a column vector with dates on the following format: yyyymm
E.g. [199001, 199002, 199003 ...]'
They are all the last trading day of the month.
How can I transform them into matlab serial date numbers?
Thanks

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 8월 8일
편집: Sean de Wolski 2014년 8월 8일
x = [199001, 199012, 199003]';
% Calculate year and month
mm = rem(x,100);
yyyy = (x-mm)./100;
% get last business day (Financial Toolbox Req'd)
last_bus_day = lbusdate(yyyy,mm)

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 8일
d=[199001, 199002, 199003 ]
a=arrayfun(@(x) datenum(num2str(x),'yyyymm'),d)
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 8일
편집: Azzi Abdelmalek 2014년 8월 8일
V commented
Dear Azzi, Thank you for your answer. However, the code you mentioned gives me the first day of month and not the last trading day. Thanks
Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 8일
There are no days in your data, look at your question, (yyyy/mm)

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by