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