필터 지우기
필터 지우기

How to concatenate horizontally two tables based on the same datetime data?

조회 수: 1 (최근 30일)
Hi! I have a question about how to concatenate horizontally two tables based on the same datetime data. Actually this will be easy if the datetime data for two tables are the same. However, I have some data which are not the same in two tables. I use this following code:
%%Horizontally concatenate datalogger1 and datalogger2
% check for the balance dimension
for p=datalogger1.DateAndTime
for q=datalogger2.DateAndTime
if p==q
datalogger=horzcat(datalogger1,datalogger2);
else
% do nothing
end
end
end
However I got an error "Data inputs must be the same size, or any of them can be a scalar.". Both tables indeed have different size. However they have mostly the same datetime data of which I want to concatenate them based on the same datetime data. Do you know how to solve it? I really appreciate for your help.

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 23일
If you convert them to timetables then you can synchronize()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by