How to use str2num function to extract a specific year from the array?
Afficher commentaires plus anciens
Hi!
I have a column matrix consists of string arrays. It's a huge time matrix and I am just showing a part of it. It contains data from year 2001 to 2019.
'2003-09-30T20:32:34Z'
'2003-09-30T20:47:34Z'
'2003-09-30T21:02:34Z'
'2003-09-30T21:17:34Z'
'2003-09-30T21:32:34Z'
'2003-09-30T21:47:34Z'
'2003-09-30T22:02:34Z'
'2003-09-30T22:17:34Z'
'2003-09-30T22:32:34Z'
'2003-09-30T22:47:34Z'
'2003-09-30T23:02:34Z'
'2003-09-30T23:17:34Z'
'2003-09-30T23:32:34Z'
'2003-09-30T23:47:34Z'
'2004-05-23T13:45:00Z'
'2004-05-23T14:00:00Z'
'2004-05-23T14:15:00Z'
'2004-05-23T14:30:00Z'
'2004-05-23T14:45:00Z'
'2004-05-23T15:00:00Z'
'2005-05-23T15:15:00Z'
'2005-05-23T15:30:00Z'
'2005-05-23T15:45:00Z'
'2005-05-23T16:00:00Z'
'2005-05-23T16:15:00Z'
'2005-05-23T16:30:00Z'
'2006-05-23T16:45:00Z'
'2006-05-23T17:00:00Z'
'2006-05-23T17:15:00Z'
'2006-05-23T17:30:00Z'
'2006-05-23T17:45:00Z'
'2007-05-23T18:00:00Z'
If I want to extract only the data from 2003, how can I select those specific rows of 2003? I personally want to use this command -
str2num(time{i}(1:4))==2003
But if there is a better alternative, I am happy to use it! Thank you so much.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Conversion 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!