Check if the condition happened in previous cycles
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Luccas S.
am 29 Dez. 2021
Bearbeitet: Torsten
am 29 Dez. 2021
I'm trying to make a condition to analyze every 5 cycles, but I need the value of p_fix (threshold) not to exceed PE. As I did, it only analyzes when it reaches 5 cycles, but I needed to check if PE>p was respected until it reaches 5 cycles again and again.
if mod(n,5)==0 && PE(n-1,1)>p_fix
fprintf('Accuses IC\n')
0 Kommentare
Akzeptierte Antwort
Matt J
am 29 Dez. 2021
Bearbeitet: Matt J
am 29 Dez. 2021
Update a boolean flag to keep track of it.
flag=true; %initial state
for n=1:N
flag=flag & PE(n-1,1)>p_fix;
if mod(n,5)==0 && flag
fprintf('Accuses IC\n')
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math 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!