How to make two conditions for a while loop?
Mostrar comentarios más antiguos
I'm making an application for L'hopitals rule so I need a while loop whenever the limit of f(x) and g(x) are both 0. How would I do that?
This is what I have
while(limit(a)=0 & limit(b)=0)
Respuesta aceptada
Más respuestas (2)
trinuj Vongsomtakul
el 15 de Feb. de 2015
Editada: Image Analyst
el 15 de Feb. de 2015
How do I write
while (testPerformance > 9 & valperformance >9)
ii = ii+1;
in MATLAB? It is an error when i try to run it. I would like to stop the iteration when these 2 conditions are met.
3 comentarios
Image Analyst
el 15 de Feb. de 2015
Try using && instead of &, like this:
while (testPerformance > 9 && valperformance >9)
ii = ii+1;
% other code....
end
Abdulaziz Abutunis
el 14 de Abr. de 2017
I think this will keep repeating the loop not stopping it
Anom Sulardi
el 17 de Jun. de 2020
while (testPerformance > 9 && valperformance >9)
ii = ii+1;
if ii==ii(end)
end
% other code....
end
Sebastian Arteaga
el 9 de Nov. de 2021
0 votos
Con I do condition OR condition in a while loop?
Categorías
Más información sobre Loops and Conditional Statements 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!