Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Find maximum values and their range and remove them to find the next maximum values
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commento
  Walter Roberson
      
      
 il 23 Nov 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
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

