elseif when the flag is not true

3 次查看(过去 30 天)
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?

采纳的回答

Stephen23
Stephen23 2022-1-7
编辑:Stephen23 2022-1-7
" 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

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by