findpeaks exceeding index dimensions

조회 수: 1 (최근 30일)
Douglas Miller
Douglas Miller 2015년 10월 3일
답변: Star Strider 2015년 10월 3일
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.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by