필터 지우기
필터 지우기

datetime don't displays the correct order

조회 수: 2 (최근 30일)
Trop Trader
Trop Trader 2024년 3월 2일
답변: Star Strider 2024년 3월 2일
aaa=datetime(dataa,"InputFormat", "dd/MM/yyyy")
'2008-01-17'
'2008-01-18'
'2008-01-19'
'2008-01-20'
'2008-01-21'
'2008-01-22'
'2008-01-23'
'2008-01-24'
'2008-01-25'
'2008-01-26'
but is not "dd/MM/yyyy"

채택된 답변

Star Strider
Star Strider 2024년 3월 2일
The 'InputFormat' and 'Format' name-value pairs are not the same. You need to specify them separately —
aaa=datetime(dataa,"InputFormat", "dd/MM/yyyy", 'Format','dd/MM/yyyy')
load('matlab_data.mat')
% whos
textdata = A.textdata
textdata = 5434×1 cell array
{'01/01/2008'} {'02/01/2008'} {'03/01/2008'} {'04/01/2008'} {'05/01/2008'} {'06/01/2008'} {'07/01/2008'} {'08/01/2008'} {'09/01/2008'} {'10/01/2008'} {'11/01/2008'} {'12/01/2008'} {'13/01/2008'} {'14/01/2008'} {'15/01/2008'} {'16/01/2008'} {'17/01/2008'} {'18/01/2008'} {'19/01/2008'} {'20/01/2008'} {'21/01/2008'} {'22/01/2008'} {'23/01/2008'} {'24/01/2008'} {'25/01/2008'} {'26/01/2008'} {'27/01/2008'} {'28/01/2008'} {'29/01/2008'} {'30/01/2008'}
aaa = datetime(textdata,"InputFormat", "dd/MM/yyyy", 'Format','dd/MM/yyyy')
aaa = 5434×1 datetime array
01/01/2008 02/01/2008 03/01/2008 04/01/2008 05/01/2008 06/01/2008 07/01/2008 08/01/2008 09/01/2008 10/01/2008 11/01/2008 12/01/2008 13/01/2008 14/01/2008 15/01/2008 16/01/2008 17/01/2008 18/01/2008 19/01/2008 20/01/2008 21/01/2008 22/01/2008 23/01/2008 24/01/2008 25/01/2008 26/01/2008 27/01/2008 28/01/2008 29/01/2008 30/01/2008
% load('matlab_aaa.mat')
% whos
I am not certain what to do with the other .mat file.
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by