how to convert the date and time into separate column
Afficher commentaires plus anciens
Hi,
I have dateandtime in the 7th column of the big data Excel file, which is from 1 to 179 rows. I want to separate the date and time into the next 2 columns. I am trying to do that but lack the experience. I have figured it out how to do it in Excel but I have like 100 spreadsheets and it's not ideal to do it there. Below is the code I have tried.
b=readtable('head.TXT');
c=b(:,7);
integer(c)-(c) % basically date is the integer and I was taking away the date from the time to achieve the timestamp.
2 commentaires
Voss
le 28 Déc 2021
I imagine that you want integer(c) to return the greatest integer less than or equal to the argument c, but - at least in my version of MATLAB - no function integer() exists. You can probably use floor() to do what you want, but you're going to want to subtract out the integer part to leave the time-of-day part:
c-floor(c)
179 rows is hardly "big". And 100 files is not a lot. Please attach one, like 'head.TXT' so we can get to work on solving your problem. We need to know the format of your date and time string. For example is it like
datestr(now)
See the FAQ for how to process a sequence of files:
Réponse acceptée
Plus de réponses (0)
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!