elseif when the flag is not true

4 visualizaciones (últimos 30 días)
Luccas S.
Luccas S. el 7 de En. de 2022
Comentada: Luccas S. el 7 de En. de 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?

Respuesta aceptada

Stephen23
Stephen23 el 7 de En. de 2022
Editada: Stephen23 el 7 de En. de 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

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by