Effacer les filtres
Effacer les filtres

Split individual cell into multiple cells

4 vues (au cours des 30 derniers jours)
Kate
Kate le 23 Nov 2016
Réponse apportée : Kate le 23 Nov 2016
I have a variable that I've imported into my workspace which has the following format:
TIMESTAMP
20100101
20100102
20100103
etc
How can I split the individual cells so that they are individual variables with only the year, month or day? As in: 2010
2010
2010 and
01
02
03
etc.
Thanks a bunch! K

Réponse acceptée

Kate
Kate le 23 Nov 2016
Answered my own question and will post for anyone who has the same issue. datevec extracts the month and day. Example:
t=datevec(TIMESTAMP)
55004 10 29 0 0 0
55004 10 30 0 0 0
55004 10 31 0 0 0
55004 11 1 0 0 0
55004 11 2 0 0 0
Then just reference specific columns of t. As in:
Month=t(:, 2);

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by