how to create vector In for/if cyklus?
Show older comments
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)
Accepted Answer
More Answers (0)
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!