MATLAB Answers

HOw to convert a variable to positive irrespictive of previous ?

26 views (last 30 days)
A=-3
B= 2
C= 4
D= A+B+C
D=9
As i am working on a loop A or B or C can be negative or positive but i have to put these in D as a positive value only

  0 Comments

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 17 Oct 2018
Edited: madhan ravi on 17 Oct 2018
abs() %gives you positive always which refers to absolute value

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by