elseif when the flag is not true

2 vues (au cours des 30 derniers jours)
Luccas S.
Luccas S. le 7 Jan 2022
Commenté : Luccas S. le 7 Jan 2022
I have this part of my code, and I was wondering if this way of implementation is right.
flag=flag & PE(n,1)>p_fix
if count1==5*N && flag
fprintf('Accuses IC\n')
elseif count1==5*N
fprintf('Does not accuse IC\n')
Basically, I wanted the else condition to happen only when count1==5*N and the flag condition was not respected. In this way I did it analyze for the condition I mentioned?

Réponse acceptée

Stephen23
Stephen23 le 7 Jan 2022
Modifié(e) : Stephen23 le 7 Jan 2022
" I wanted the else condition to happen only when count1==5*N and the flag condition was not respected."
Make the code explicit:
if count1==5*N
if flag
fprintf('Accuses IC\n')
else
fprintf('Does not accuse IC\n')
end
end
  1 commentaire
Luccas S.
Luccas S. le 7 Jan 2022
Alright, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by