Create a table with timedate and values

1 次查看(过去 30 天)
Hello,
I got 2 mat files:
  • old.mat that is 432x2 with time date 01/01/2016 05:00:00 with an interval of 1 minute in each row and a variable X in the 2nd column;
  • new that is a 423x3, with time in the 1st column and values for variables Y1 and Y2, in the 2nd and 3rd column
Objective newtable(:,1) = old(:,1); newtable(:,2) = old(:,2); newtable(:,3:4) = new (:,2:3)
I tried newtable = [old(:,1:2) new(:,2:3)] but i got an error:
All inputs must be datetimes or date/time character vectors or date/time strings.

采纳的回答

Peter Perkins
Peter Perkins 2018-4-6
It's pretty much impossible to say for sure what you're doing wrong without knowing what's in those mat files, but based on the error you show, it seems like you have a datetime variable and are trying to horzcat it with either a table or a numeric matrix. If variables is a numeric matrix, use array2timetable on your matrix with t_ref as the row times. If it's a table, use table2timetable.
  2 个评论
Tiago Dias
Tiago Dias 2018-4-6
ok, i loaded an example to better understanding
Tiago Dias
Tiago Dias 2018-4-6
no clue what i did different today compared to yesterday but what i wrote on the explanation now is working, sorry and thanks for your time

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by