How to find min and its index in calendarDuration array

2 vues (au cours des 30 derniers jours)
Bohdan Perviy
Bohdan Perviy le 29 Jan 2020
Commenté : Bohdan Perviy le 29 Jan 2020
I got such an array and its min element has 8th index (the closest duraion). Min() function won't work. Apparently it needs some conversion
  5 commentaires
Mohammad Sami
Mohammad Sami le 29 Jan 2020
days = split(t,'days');
Bohdan Perviy
Bohdan Perviy le 29 Jan 2020
I moved back to the Duration class, because previously i used between() so that as a result i got calendarDuration array, but now i solved the problem using difference between Datetime array and Datetime value
% v1 = between(start_manvr, string(outcome(:,3)));
v1 = datetime(string(outcome(:,3))) - start_manvr
[c,index] = min(abs(v1));
Anyway, thanks for the tip about Duration class

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by