Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

set daten 1 does not work

1 view (last 30 days)
Micky Josipovic
Micky Josipovic on 18 May 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi there,
I set 2 dates to work with a matrix(-es). During the work had to save the matrix and restart my work from a specific date.
% daten1=floor(soil(1,1));
daten1=datenum(soil(2019,12,2));
daten2=floor(soil(end,1));
but it always picks either the first date or comes with an error like:
Index in position 3 exceeds array bounds (must not exceed 1).
  2 Comments
dpb
dpb on 18 May 2020
daten1=datenum(soil(2019,12,2));
is trying to use soil as a variable dimensioned as a 3D array with what appear to be specific year, month and day values used as indices into the array. That's probably not what intended but we don't know how you have the data stored to know just what it is for absolutely certain. It appears from the message it may be a 2D array, but likely isn't stored against indices that match years and months.
daten1=datenum(2019,12,2);
would give you a datenum corresponding to December 2, 2019 if that is what you have in mind. How to relate that to some position in the data, we really can't say without knowing how those data are stored.
It would be better to get away from using the deprecated datenum and switch to the datetime class for new work; it has many features including integrated support by plotting routines that make it far more convenient in the end.
Micky Josipovic
Micky Josipovic on 18 May 2020
Thanks for sending me your answer. I will attend to this issue later.
Micky

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!