필터 지우기
필터 지우기

Combing the data in two rows in a table

조회 수: 1 (최근 30일)
John Doe
John Doe 2020년 1월 25일
댓글: John Doe 2020년 1월 27일
Hello everyone!
I hope you're doing well.
I have a question relating to combing data from two rows in a table. I want to form a single row depending on the data present. For example, if the data is repeated i want it to be mentioned once, if it's not repeated i want it to be combined. I also have a start and an end time for both my rows that I want to have them as a continuation.
Just to make things clearer, I've attached what I need help in and I've also attached how I want the results to look like (I did it manually).
If more information is needed, please let me know. I'd b grateful for any sort of guidance.
Thank you!!
  댓글 수: 2
Mohammad Sami
Mohammad Sami 2020년 1월 26일
편집: Mohammad Sami 2020년 1월 26일
Have you tried using unique ?
[~,rows_you_want_to_keep] = unique(var(:,{'Col1' 'Col2'}),'rows');
% change Col1 Col2 ... to columns you want to check duplicates for
uniq_tab = var(rows_you_want_to_keep,:);
John Doe
John Doe 2020년 1월 27일
It doesn't work :/ I'm trying to write if conditions around it but it isn't very elegant

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by