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

1 次查看(过去 30 天)
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

采纳的回答

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

更多回答(1 个)

Amneh Alshawabka
Amneh Alshawabka 2018-12-2
Thank u very much

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by