Info
此问题已关闭。 请重新打开它进行编辑或回答。
Find maximum values and their range and remove them to find the next maximum values
1 次查看(过去 30 天)
显示 更早的评论
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.
1 个评论
Walter Roberson
2016-11-23
Duplicated by later http://www.mathworks.com/matlabcentral/answers/313548-find-maximum-values-and-their-range-and-remove-them-to-find-the-next-maximum-values which has an answer
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!