필터 지우기
필터 지우기

Error getting day of year from datetime.

조회 수: 2 (최근 30일)
Adrienne Marshall
Adrienne Marshall 2016년 4월 11일
댓글: Adrienne Marshall 2016년 4월 11일
Hi - I'm trying to extract a day of year from a datetime, and get the error message: "Function 'subsindex' is not defined for values of class 'datetime'."
I get this message even when I copy-paste the code from the documentation for the day function:
t = [datetime('yesterday');datetime('today');datetime('tomorrow')]
d = day(t)
Any ideas or suggestions?

채택된 답변

Steven Lord
Steven Lord 2016년 4월 11일
You've probably defined a variable named day in your workspace. MATLAB is trying to use the datetime array as an index into that variable, but MATLAB doesn't know how to do that. [What is x(lastTuesday)?] Remove the variable and the command should work.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by