Filter löschen
Filter löschen

How to insert datetime data into table ?

75 Ansichten (letzte 30 Tage)
Pradya Panyainkaew
Pradya Panyainkaew am 25 Jan. 2018
Kommentiert: Steven Lord am 25 Jan. 2018
I have a 2976x1 datetime data that contains date and time from 01-Dec-2016 00:15:00 to 01-Jan-2017 00:00:00 with time different is 15 mins. How can I insert this data into A(:,2) of matrix A size 2976x4 table.
Thank you in advance

Antworten (1)

Walter Roberson
Walter Roberson am 25 Jan. 2018
A{:,2} = TheTimeData(:);
  5 Kommentare
Peter Perkins
Peter Perkins am 25 Jan. 2018
Pradya, "The software doesn't allow we insert datetime variables into table array." is only true for parenthesis subscripting. There are several ways to add a new variable to a table. Walter's second suggestion is the most obvious and efficient, but you caould also have created a table with one variable out of your datetime vector, and assigned that to the table with parenthesis subscripting, or even just concatenated it onto the right side.
Steven Lord
Steven Lord am 25 Jan. 2018
If the times are somehow "special" in your table, consider converting your table into a timetable with your datetime variable as the RowTimes. You can do this using the table2timetable function, specifically the last signature in the Description section on that page. For more information on what you can do with a timetable, see the documentation.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by