how to run an index loop while using find function
Show older comments
I have two sets of (time) array. By using the time of red mark(ECG) as indicated in the picture. I'm trying to sweep to the right by fixed range (peakgap) to find the blue mark by using find function with condition RpeakTime<PPG1peakTime<PPG1peakTime+peakgap.
I'm trying to figure it out to use find function with index loop. How can I get the answer data of every red plot in array using for loop.
this is my code but I know it does not work
PPG1Psize = numel(PPG1peakTime);
peakgap = ((PPG1Psize)/(3*tend)); %estimate delay time between each ECG peak
for j=1:numECG
[rows,columns] = find(PPG1peakTime>RpeakTime(i) & PPG1peakTime<(RpeakTime(i)+peakgap));
end

6 Comments
Star Strider
on 10 Nov 2019
Use the findpeaks (or islocalmax) function to get the peaks and locations of each vector separately (EKG & PPG). Then you can get the relevant time differences from those results.
This would be much easier with your data (individual time vectors and corresponding EKG and PPG values).
Tipnirin Vajanarat
on 10 Nov 2019
Edited: Tipnirin Vajanarat
on 10 Nov 2019
Star Strider
on 10 Nov 2019
My pleasure.
There are several ways to correct a wandering baseline (the easiest in my opinion is to use a highpass filter, or bandpass filter to also remove high-frequency noise).
I cannot help you unless I have a representative sample of your data.
Tipnirin Vajanarat
on 10 Nov 2019
Image Analyst
on 10 Nov 2019
Did you see the last sentence of Star's comment?
Tipnirin Vajanarat
on 11 Nov 2019
Edited: Tipnirin Vajanarat
on 11 Nov 2019
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics 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!