bypass an "if" within another using a flag
Mostrar comentarios más antiguos
Hi everyone,
I have the code below:
a=5; b=4; c=3; d=2;
if a>b
if b>c % ====> this
if c>d
disp('i''m in!')
end
end % ======> this
end
Is it possible I bypass the " if b>c" using a flag?
e.g. FLAG=1, include this if, and FLAG=0, bypass this if.
Thanks!
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 8 de Abr. de 2023
Since the b>c test occurs only inside the a>b block, and it's the only thing in the a>b block, you could simply do
if a>b && b>c
if c>d
disp('i''m in!')
end
end
1 comentario
Mehrdad Bahadori
el 8 de Abr. de 2023
Editada: Walter Roberson
el 8 de Abr. de 2023
Categorías
Más información sobre Schedule Model Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!