How do I use a plus and minus in a variable
Show older comments
Example :
B=5+-4
1 Comment
Image Analyst
on 6 Mar 2022
Edited: Image Analyst
on 19 Apr 2022
What would you expect the answer to be?
B = 5+-4
Answers (1)
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
1 Comment
Majorpain22
on 6 Mar 2022
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!