subsetting dates in a matrix
Afficher commentaires plus anciens
Hello,
I have a time series in a matrix and first column is serial date numbers (up to millisecond precision), and other columns my samples. I would like to get those rows that belong to for example '12-Oct-2012'. I couldn't figure out how to write the logical operator to get a slice of this matrix. I would like to hopefully avoid some sort of slow string comparison.
Thanks in advance
2 commentaires
Azzi Abdelmalek
le 1 Nov 2013
Show the two first rows of your data
Cagdas Ozgenc
le 1 Nov 2013
Modifié(e) : Cagdas Ozgenc
le 1 Nov 2013
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 1 Nov 2013
If A is your cell array
c1=cellstr(datestr(A(:,1),'dd-mm-yyyy'))
idx=ismember(c1,'12-10-2012')
out=A(idx,:)
1 commentaire
Cagdas Ozgenc
le 1 Nov 2013
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!