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

3 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Dez. 2018
mask = a < 0;
result(mask) = (a(mask) -c)/d;

Weitere Antworten (1)

Amneh Alshawabka
Amneh Alshawabka am 2 Dez. 2018
Thank u very much

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by