On multiple logical test failing in if statement
Afficher commentaires plus anciens
Hello, I am trying to run an if statement with multiple conditions as below,
if abs(a-a_t)>0.0001 && abs(b-b_t)>0.00001 && abs(c-c_t)>0.0001 && abs(d-d_t)>0.00001
x=0;
y=0;
end
Even when all the conditions are satisfied, the values of x and y are not updated. But, it works if we have just two conditions (I've tried different combinations of two variable values which work, but using all conditions in separate brackets doesn't work). MATLAB documentation says that multiple logical operators could be used, but it doesn't seem to be working in my case. Is there a limit to the number of logical operators that could be combined? Or, am I missing something?
Thanks for your advice.
2 commentaires
"Is there a limit to the number of logical operators that could be combined?"
No.
"Or, am I missing something?"
Probably. How are you checking the output? Please show us the exact input values (all eight of them). Please upload your code by clicking the paperclip button.
Tailman
le 8 Juil 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!