How can I find -ve/+ve numbers in a column and then apply a different specific equation for each?

3 views (last 30 days)
if a is a column of 101 numbers. then
negative number in a= (negative number - c)/d
positive number in a =(positive number-k)/m
and save these values in a new coulmn in ax (at the same orginal order in a)
any one can help me please? plzzzzzzzzzz

Accepted Answer

Walter Roberson
Walter Roberson on 1 Dec 2018
mask = a < 0;
result(mask) = (a(mask) -c)/d;

More Answers (1)

Amneh Alshawabka
Amneh Alshawabka on 2 Dec 2018
Thank u very much

Categories

Find more on Operators and Elementary Operations 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!