Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Find maximum values and their range and remove them to find the next maximum values

조회 수: 1 (최근 30일)
Safwan
Safwan 2016년 11월 22일
마감: Walter Roberson 2016년 11월 23일
I am trying to write a code that finds maximum value and its range. However, I want the code to find the next maximum value but the previous maximum value is removed or set to zero. This is what I got so far.
x = Data(:, 1); % import Y of column 1 from Data
B = zeros(1,100000000); % pre-allocate B
for n = 1:500
[M,I] = max (x);
B(n) = M;
x(I) = -Inf;
if M > 2 % set threshold
c = x(I-299 : I+700); % range of data points to be taken from x
c = c'; % transpose c
pulse(n,:) = c; % n-th row of pulse
end
end
The code does not remove the maximum value and its range. I have tried putting c = 0 and x(I-299:I+700) = 0 but they don't work. And I am still unsure where do I have to insert it.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by