Optimize an if loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ricardo López
am 8 Nov. 2020
Kommentiert: Ricardo López
am 9 Nov. 2020
Good night people,
I have a question regarding the optimization of the following loop:
for i=1:length(PV)
if i>3
if NL(i-1)<=100
if NL(i-2)<=100
if NL(i-3)<=100
u(i)=1;
else
u(i)=0;
end
end
end
end
end
I would like to reduce the if statements.
Thanks for your time,
0 Kommentare
Akzeptierte Antwort
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!