Info

此问题已关闭。 请重新打开它进行编辑或回答。

set daten 1 does not work

2 次查看(过去 30 天)
Micky Josipovic
Micky Josipovic 2020-5-18
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
dpb
dpb 2020-5-18
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 2020-5-18
Thanks for sending me your answer. I will attend to this issue later.
Micky

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by