i have a for loop which generates the BERR, and Received power, i want to find the number of times the if else statement is true,so to draw a bar graph, could anyone help me out?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
if BERR<10^-5
display ('pass stage 1')
if PRx>-78
display ('pass stage 2')
else
display ('fail')
end
else
display ('fail')
end
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Jul. 2012
passed1 = 0;
passed2 = 0;
fail1 = 0;
fail2 = 0;
if BERR<10^-5
display ('pass stage 1')
if PRx>-78
display ('pass stage 2')
passed2 = passed2 + 1;
else
display ('fail')
fail2 = fail2 + 1;
end
else
display ('fail')
fail1 = fail1 + 1;
end
Myself, I'd probably be thinking in terms of
passed = sum( (BERR<10^(-5)) & (PRx > -78) );
2 Kommentare
Walter Roberson
am 9 Jul. 2012
An evaluated expression is true when the result is nonempty and contains all nonzero elements (logical or real numeric). Otherwise, the expression is false.
With that emphasized, please reconsider "if edtberr(1,:)<10^-5"
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!