Effacer les filtres
Effacer les filtres

Problem with retime function

1 vue (au cours des 30 derniers jours)
yogan Sganzerla
yogan Sganzerla le 5 Août 2021
Commenté : Peter Perkins le 5 Août 2021
Hello,
I am trying to use retime in my Table however I am facing one problem.
As you can see in the Image above, this is my time vector and from 2nd July on 12:00 bis 8th July 12:00 I don't have data (this is why is a vertical line)
Well, I would like to fill in this vector with Zeros. Fro that I used the following code:
TT2 = retime(theRawData, newTimes, 'Constant',0)
where theRowData is my origical table without data from 2nd bis 8th
the newTimes is a vector for that I created with all the time even where I don't have data.
I am attachin the variables as well.
The idea it to fill in with zeros just in the time where we don't have data, however from 02 july 12:00 until the end of my vector , I am receiving zeros.
Thanks in advance.
  1 commentaire
Peter Perkins
Peter Perkins le 5 Août 2021
Yogan, you have two problems.
First, you are not specifying a method for the retime. The default is fillwithmissing, and that's what it's doing.
Second, you new times are almost all different than the time vector in theRawData. So you are creating a new timetable with a different time vector, almost all filled with NaN.
>> d = newTimes(1:5) - theRawData.theDatetimevector(1:5);
>> d.Format = 's'
d =
5×1 duration array
0 sec
0 sec
9.7656e-06 sec
9.7656e-06 sec
9.5215e-06 sec
>> newTimes.Format = 'uuuu-MM-dd HH:mm:ss.SSSSSSSSS';
>> theRawData.theDatetimevector.Format = 'uuuu-MM-dd HH:mm:ss.SSSSSSSSS';
>> newTimes(1:15),theRawData.theDatetimevector(1:5)
ans =
5×1 datetime array
2021-07-02 05:01:00.000000000
2021-07-02 05:01:01.016952636
2021-07-02 05:01:02.033905273
2021-07-02 05:01:03.050857910
2021-07-02 05:01:04.067810546
ans =
5×1 datetime array
2021-07-02 05:01:00.000000000
2021-07-02 05:01:01.016952636
2021-07-02 05:01:02.033895507
2021-07-02 05:01:03.050848144
2021-07-02 05:01:04.067801025

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Timetables dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by