Azzera filtri
Azzera filtri

Create a table with timedate and values

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by