Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

set daten 1 does not work

1 vue (au cours des 30 derniers jours)
Micky Josipovic
Micky Josipovic le 18 Mai 2020
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaires
dpb
dpb le 18 Mai 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 le 18 Mai 2020
Thanks for sending me your answer. I will attend to this issue later.
Micky

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by