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 Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by