findpeaks exceeding index dimensions

2 次查看(过去 30 天)
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

回答(1 个)

Star Strider
Star Strider 2015-10-3
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.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by