필터 지우기
필터 지우기

Create a table with timedate and values

조회 수: 1 (최근 30일)
Tiago Dias
Tiago Dias 2018년 4월 5일
댓글: Tiago Dias 2018년 4월 6일
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