findpeaks exceeding index dimensions
3 views (last 30 days)
Show older comments
Hello,
I'm having trouble using findpeaks on the follwing image inserted. Here's the code I'm using currently:
importdata('ctrl2415.m')
figure; plot(Clock, intensity')
xlabel('Time (sec)'); ylabel('Intensity')
[PKS,LOCS] = findpeaks(intensity(:,1));
[PKS2,LOCS2] = findpeaks(smooth_trace);
idx_to_peak = find(PKS2 >= 0);
hold on; plot(Clock(LOCS2(idx_to_peak)), PKS2(idx_to_peak), 'co')
To walk through the code, the file imported is fluoresence data from 12 total cells for approximately 230 seconds. However, when I run the second half, I get the error Index exceeds dimensions. I'm not sure how to adjust the values for the code to function properly. Any help is greatly appreciated.
-Doug
0 Comments
Answers (1)
Star Strider
on 3 Oct 2015
What is the size of ‘smooth_trace’? It doesn’t appear to be defined in your code. (The findpeaks function may be a curious about it as the rest of us.) Also, findpeaks has a number of quite useful ‘name-value pair’ arguments that would likely make the find call unnecessary.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!