Effacer les filtres
Effacer les filtres

how to add a time column to a matrix

2 vues (au cours des 30 derniers jours)
zeezo
zeezo le 8 Mai 2016
Commenté : zeezo le 8 Mai 2016
a=['07:00:00'; '07:15:00'; '07:30:00'];
% add 60 seconds to 07:00 , 85sec to 07:15 and 136sec to 07:30
add = [60; 85; 136];
sec_per_day = 24*60*60;
Result = datestr(datenum(a, 'HH:MM:SS') + add/sec_per_day, 'HH:MM:SS')
Result =
07:01:00
07:16:25
07:32:16
Now I want to add the Result to matrix ( K )to become the 3rd column K=[34 45; 75 345; 35 65]
How can I do that?

Réponses (1)

Walter Roberson
Walter Roberson le 8 Mai 2016
Result is a string. It is not possible to have strings in a numeric matrix. You need to use cell arrays or table() or dataset()
  1 commentaire
zeezo
zeezo le 8 Mai 2016
thank you
how can I use cell arrays or table() or dataset()?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical 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