Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

set daten 1 does not work

1 visualizzazione (ultimi 30 giorni)
Micky Josipovic
Micky Josipovic il 18 Mag 2020
Chiuso: MATLAB Answer Bot il 20 Ago 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 Commenti
dpb
dpb il 18 Mag 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 il 18 Mag 2020
Thanks for sending me your answer. I will attend to this issue later.
Micky

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by