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

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

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

Più risposte (1)

Amneh Alshawabka
Amneh Alshawabka il 2 Dic 2018
Thank u very much

Categorie

Scopri di più su Operators and Elementary Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by