First point smaller than threshold

조회 수: 1 (최근 30일)
Konstantinos
Konstantinos 2016년 5월 18일
댓글: Konstantinos 2016년 5월 18일
I have written the following code in order to find the first point of an array which is smaller than a threshold and calculate, afterwards, its distance from a certain point:
xfb1 = 7*10^7;
xfb2 = 6*10^7;
for i = 1:length(pks3) %find the point which is the start of QRS
k = pks3(i):-1:length(xfb);
first = k(k<xfb1); % find all k such that k is smaller than xfb1
if ~isempty(first)
first = first(1); %store the first number which is smaller than xfb1
else
disp('No value of k is smaller than xfb1.')
end
numPointsQ = 1:length(locs_RwaveB(i):first);
mean_numPointsQ = mean(numPointsQ);
Qstart = locs_RwaveB(i)*mean_numPointsQ;
end
The data come from electrogram recordings and the problem is that even though a have 250,000 samples in total from a recording, I get a massive amount of points in the end (10^12) which cannot be possible. I think it has to do with the for loop, as I ask it to run 10 times starting from 10 specific pks3 points each time, but for each array k I create I want only one first point to be detected. Could someone please tell me what's wrong with the for loop?
Thanks

답변 (1개)

Steven Lord
Steven Lord 2016년 5월 18일
Take a look at the n input described in the documentation for the find function.
  댓글 수: 1
Konstantinos
Konstantinos 2016년 5월 18일
I'm sorry but that's not helpful enough for my case. Thanks though for the answer.

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

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by