Merging tables of dissimilar rows in MATLAB.

조회 수: 1 (최근 30일)
DEYIRE UMAR
DEYIRE UMAR 2018년 8월 27일
편집: jonas 2018년 8월 27일
My program runs in parallel using parfeval to generate two tables of data. one from a sensor and the other from a robot (UR5). I want to merge these two tables together. The common column is the Time, although there are little differences in their times as they run at different speeds and that makes the rows unequal too. But I want a table containing all the other variables from rows which times are equal or very close. So at the end, there will be only one column for Time. Find photos of sample results attached. Can I get a help?

채택된 답변

jonas
jonas 2018년 8월 27일
편집: jonas 2018년 8월 27일
You can do the following steps:
If I remember correctly, synchronize will pad the shorter arrays with NaN's.
Please provide actual data (not images) if you need help with the code.
  댓글 수: 9
DEYIRE UMAR
DEYIRE UMAR 2018년 8월 27일
I really need this. the variable names are needed other than ' var'
jonas
jonas 2018년 8월 27일
편집: jonas 2018년 8월 27일
@Sean de Wolski: Thanks, that works!
@DEYIRE: That's easy. Just write your desired names in a cell array like this:
TT.Properties.VariableNames={'A','B','C','D','E','F','G','H','I','J'}
The cell array must have the same number of cells as the number of table columns (excluding the column with time), and you can only use names that also function as variables, i.e. A-Z and underscore _.
Please copy and paste the code from the previous comment one more time to your script. I made a small but important change.
Finally, please accept if the answer was helpful :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

DEYIRE UMAR
DEYIRE UMAR 2018년 8월 27일
I got it now. I merged and removed NaN but the rows I have are too little because only rows with same Time were picked. I used this code:
Log_table = outerjoin(tcp_coordinates,forces,'MergeKeys', true); Log_table = Log_table(~any(ismissing(Log_table),2),:); writetable(Log_table,'AllData.csv','Delimiter',',')
Now am asked to make it a table with not only same row values of Time but also close values so that it becomes much. I don't know if this is possible? but it doesn't look easy.

카테고리

Help CenterFile Exchange에서 Timetables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by