Difference between datetime values in minutes
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tycho Maas
am 30 Dez. 2020
Kommentiert: Ameer Hamza
am 30 Dez. 2020
Hi,
I need some help. I have an array with multiple columns and with in one of these columns dates+times as a datetime format, this array is linked as data_combined.mat. The array looks like this:
06-Dec-2020 00:04:00 '06-Dec-2020' 7 76.8566666666667
06-Dec-2020 00:20:00 '06-Dec-2020' 6.30000000000000 77.6833333333333
06-Dec-2020 00:40:00 '06-Dec-2020' 5.10000000000000 78.7166666666667
I need help calculating the difference between the datetimes in minutes and creating a column containing these values. For example, this is what the above array would then look like:
1 06-Dec-2020 00:04:00 '06-Dec-2020' 7 76.8566666666667
17 06-Dec-2020 00:20:00 '06-Dec-2020' 6.30000000000000 77.6833333333333
37 06-Dec-2020 00:40:00 '06-Dec-2020' 5.10000000000000 78.7166666666667
Can anybody help me writing some code to do this?
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 30 Dez. 2020
Try this
col = minutes([all_combined_short{:,1}].'-all_combined_short{1,1})+1;
all_combined_short = [num2cell(col), all_combined_short]
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calendar finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!