Filter löschen
Filter löschen

Create a table with timedate and values

1 Ansicht (letzte 30 Tage)
Tiago Dias
Tiago Dias am 5 Apr. 2018
Kommentiert: Tiago Dias am 6 Apr. 2018
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.

Akzeptierte Antwort

Peter Perkins
Peter Perkins am 6 Apr. 2018
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 Kommentare
Tiago Dias
Tiago Dias am 6 Apr. 2018
ok, i loaded an example to better understanding
Tiago Dias
Tiago Dias am 6 Apr. 2018
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

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