MATLAB: HOw to convert a variable to positive irrespictive of previous negativepositivesign 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 Best Answer abs() %gives you positive always which refers to absolute value Related SolutionsMATLAB: Check Positive or Negative Infinity sign(abc) .* isinf(abc) MATLAB: Return to previous step Do you mean something like this?% Step Awhile( true ) % Step B % Step C % Step D if( condition ) continue % <-- return to Step B end % Step E break % <-- go to Step Fend% Step FWithout more details about your code, it is hard to know what logic you really need. Related QuestionExtracting positive numbersHow to find prime numbersSorting through labelled dataConverting positives to negatives in a column.How can i solve this equation
Best Answer