Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Find maximum values and their range and remove them to find the next maximum values
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Walter Roberson
el 23 de Nov. de 2016
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
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!