How do I use a plus and minus in a variable
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Example :
B=5+-4
1 commentaire
Image Analyst
le 6 Mar 2022
Modifié(e) : Image Analyst
le 19 Avr 2022
What would you expect the answer to be?
B = 5+-4
Réponses (1)
DGM
le 6 Mar 2022
Modifié(e) : DGM
le 6 Mar 2022
If we're simply working with numeric variables, something like this may work:
B = 5 + [4 -4]
Or in cases where the +/- term is verbose, you might use a simple multiplication to avoid repeating the term:
B = 5 + [1 -1]*cosd(12+90) % or some other expression
Voir également
Catégories
En savoir plus sur Historical Contests dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!