WHY CAN'T I PLOT THIS WITH "DATETIME"?

조회 수: 9 (최근 30일)
Pul
Pul 2021년 7월 20일
댓글: Star Strider 2021년 7월 21일
Hello everyone,
I can't plot because of the error with "data time".
Does anyone know how I can solve this problem.
Thank you.

채택된 답변

Star Strider
Star Strider 2021년 7월 20일
The first column is not a valid datetime array. It first needs to be converted to one.
Try this —
LD = load('LARSEN_MMEQ1.mat');
LARSENMMEQ1 = LD.LARSENMMEQ1;
LARSENMMEQ1.Var1 = datetime(LARSENMMEQ1.Var1, 'InputFormat','MM/dd/yyyy');
x = LARSENMMEQ1.Var1;
y = LARSENMMEQ1.Var2;
figure
plot(x, y)
grid
producing —
.
  댓글 수: 8
Pul
Pul 2021년 7월 21일
Thank you very much.
You've been very kind.
Star Strider
Star Strider 2021년 7월 21일
As always, my pleasure!
.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by