Afficher commentaires plus anciens
% Note :- in this code y & x has 10 values, but every time I run % the command it will give me this error... %*(??? Operands to the and && operators must be convertible to logical scalar values.)*
Error in ==> dewpointT at 75 if (abs(raw(1)) < 1e-5 && abs((y./K)-x) < 1e-5)
raw(1)= sum(y./K)-1;
if (abs(raw(1)) < 1e-5 && abs((y./K)-x) < 1e-5)
break
1 commentaire
Jan
le 4 Mar 2012
Please use a meaningful subject line and tags.
Réponse acceptée
Plus de réponses (1)
Jan
le 4 Mar 2012
0 votes
The error message is very clear: "Operands to and && operators must be convertible to logical scalar values." It is always worth to read the error messages of Matlab.
2 commentaires
Nasir Qazi
le 5 Mar 2012
Walter Roberson
le 5 Mar 2012
Nasir, it doesn't bomb out with an error if you change to &, but that doesn't mean that it works. Please review Titus's response and study the documentation for "any" and "all"
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!