how to create vector In for/if cyklus?
Mostra commenti meno recenti
Hy , I would like to create maxim vector what is should contain the numbers, when the if is true,then the index of the number it was saven in the empty maxim vector...the if is 3 times is true in for cyklus but the output is , always rewrite the before value what was in the maxim
maxim = [];
for i=2:80
if (y(i-1)<y(i) && y(i+1)<y(i))
for j=1:(j+1)
maxim(j) = y(i)
end
end
end
y1 = maxim(1)
y2 = maxim(2)
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Multidimensional Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!