First point smaller than threshold
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Steven Lord
on 18 May 2016
Take a look at the n input described in the documentation for the find function.
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!