Add specific date time column to every table inside a cell

1 vue (au cours des 30 derniers jours)
BN
BN le 10 Fév 2020
Commenté : Luna le 10 Fév 2020
Hey all, Here is my cell:
Capture.JPG
I want to add a date-time column for each table. In fact, my date time column is just date.mat. I attached C too. So in the output, I would like a 40 x 32 cell (just like this C), with 336 x 4 tables inside it. I would like to have a date in the front existing column in each table.
Thank you.

Réponse acceptée

Luna
Luna le 10 Fév 2020
Modifié(e) : Luna le 10 Fév 2020
Easiest and fastest way to do it using a cellfun and converting them to a timetable. Here is one line to do it all:
NewCellArray = cellfun(@(x) table2timetable(x,'RowTimes',date),C2LatLon,'uni',false);
Or if you don't want a timetable just a table with a date column you can use below:
NewCellArray2 = cellfun(@(x) addvars(x,date,'Before','lon') ,C2LatLon,'uni',false);
  2 commentaires
BN
BN le 10 Fév 2020
Thank you
Luna
Luna le 10 Fév 2020
Your welcome ;)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by