Does anyone know how to allocate a vector with datetime elements?

조회 수: 27 (최근 30일)
Somayeh Amayeh
Somayeh Amayeh 2015년 11월 24일
편집: Chris Turnes 2015년 11월 24일
I tried at the biginning allocating zeros vector, but it is not allowed to write on them datetime while the loop is executing. I tried allocating empty cells but still seems not to work.
Thanks in advance.

채택된 답변

Chris Turnes
Chris Turnes 2015년 11월 24일
편집: Chris Turnes 2015년 11월 24일
This question has appeared before, but there are two options I didn't see in that thread. One is to allocate an array of "Not-a-Time" elements with NaT:
d = NaT(1, 100);
Another is to do something like:
d(100) = datetime; % or NaT, or any datetime you want
which effectively does the same thing.

추가 답변 (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