필터 지우기
필터 지우기

remove duplicates from matrix and create a logic to index

조회 수: 1 (최근 30일)
MKM
MKM 2022년 3월 25일
편집: KSSV 2022년 3월 25일
i have a table with time and it contains some duplicated times. i would like to remove those duplicated times and then be able to use this to index into another matrix so i can find out what happens at that specific time that is not a duplicated time.
time = [1 2 2 3 4 4 5 6 6 7 8 ]'
data= is the same size as matrix as time;
i would like to remove those duplicated times and then index into data so at times [1 2 3 4 5 6 7 8].

채택된 답변

KSSV
KSSV 2022년 3월 25일
편집: KSSV 2022년 3월 25일
REad about the function unique.
time = [1 2 2 3 4 4 5 6 6 7 8 ]' ;
[c,ia,ib] = unique(time) ;
data = data(ia) ;

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by