How to add a column with all rows have the same data in a table?

39 vues (au cours des 30 derniers jours)
Mario Diaco
Mario Diaco le 26 Mai 2020
Modifié(e) : Adam Danz le 3 Nov 2020
Hello!
How to add a column with all rows have the same data (es. '31-Jan-2015') in a table?
Thanks

Réponse acceptée

Adam Danz
Adam Danz le 26 Mai 2020
Demo
% Create table
T = table([1;2;3;4],'VariableNames',{'Data'});
% Create date vector
data = datetime('now') + (1:4)';
% Add the column of dates to the table
T.Dates = data;
The column vector must have the same number of rows as the table.
  4 commentaires
Mario Diaco
Mario Diaco le 26 Mai 2020
Thanks a lot!
Adam Danz
Adam Danz le 26 Mai 2020
Modifié(e) : Adam Danz le 3 Nov 2020
Glad I could help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by