Why is the maximum length of a datetime array 142?
Show older comments
Hello,
I am trying to initialize a vector of datetime arrays and I can't go beyond a length of 142. Why is that? Is there a workaround?
Here's my code:
datetime_array = NaT(1,length(myTimeStamps));
for i=1:length(datetime_array)
datetime_array(i,:) = datetime(myTimeStamps(i,:);
end
Error: Index in position 1 exceeds array bounds (must not exceed 142).
Thank you,
Lindsey
3 Comments
Walter Roberson
on 22 Jul 2019
Be careful with length() as it is the maximum dimension, not the number of rows necessarily. Your array might be 142 by something larger than 142.
Adam Danz
on 22 Jul 2019
Datetime array can be much longer than 142. This one below is 10,000 timestamps long.
datetime(1950,1:10000,1)
What is stored in myTimeStamps? Could your provide an example? Perhaps one of them is empty.
LMA
on 23 Jul 2019
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!