필터 지우기
필터 지우기

Concatenating a signal given its segments' limits

조회 수: 1 (최근 30일)
Paramonte
Paramonte 2023년 12월 2일
댓글: Voss 2023년 12월 3일
Hello there:
I have this vector (a small sample) :
ww =
10 15
16 22
33 44
45 50
51 60
70 80
These are intervals that delineate a biomedical signal in segmants. For instance segment#1 delineates the signal beteewn the samples 10 and 15, segmnent#2 delineates the signal beteewn the samples 16 and 22. Segmnent#3 delineates the signal beteewn the samples 33 and 44. And so on. We want the segments whose distance is less than N samples to be concatenated. For isnatance for N=1 the result would be:
ww_new =
10 22
33 60
70 80
Thank you for your time!
Regards

채택된 답변

Voss
Voss 2023년 12월 2일
ww = [
10 15
16 22
33 44
45 50
51 60
70 80
];
N = 1;
to_keep = ww(2:end,1)-ww(1:end-1,2)>N;
to_keep = [[true; to_keep] [to_keep; true]];
ww_new = reshape(ww(to_keep),[],2)
ww_new = 3×2
10 22 33 60 70 80
  댓글 수: 2
Paramonte
Paramonte 2023년 12월 3일
Many thanks, It works indeed! Cheers!
Voss
Voss 2023년 12월 3일
You're welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by