Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

can anybody tell me the logic of this code

조회 수: 1 (최근 30일)
Priyanka Urban
Priyanka Urban 2014년 3월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
th=abs(max(y)); th=th/2; c=0; % peaks are seen as pulses(heart beats) for i=1:1:length(y) if y(i)>th qrs(i)=1; c=c+1; i=i+15; else qrs(i)=0; end end

답변 (1개)

Roger Stafford
Roger Stafford 2014년 3월 10일
This is not good code. The index 'i' of the for-loop is advanced by 15 if y(i)>th is true, apparently expecting to skip the next 14 checks on y. However, this is not what will happen. The for-loop will stubbornly return with 'i' set to the next sequential value after that last one, and do no skipping.

Community Treasure Hunt

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

Start Hunting!

Translated by