array multiplication with a negative value

16 ビュー (過去 30 日間)
Bathrinath
Bathrinath 2014 年 6 月 11 日
コメント済み: Bathrinath 2014 年 6 月 11 日
A=[0,-2.2,-3.3,-25;1.2,0,-1.1,12;2,-8,8,0] my answer is to be A=[0,-2.2,-3.3,-25;-1.2,0,-1.1,-12;-2,-8,-8,0]. I need to convert the values in A which is greater than zero as -A. I have used if A(A > 0) A=-A; end This is not working. Suggest some points

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 6 月 11 日
編集済み: Andrei Bobrov 2014 年 6 月 11 日
t = A > 0;
A(t) = -A(t);
or
A = -abs(A);
  1 件のコメント
Bathrinath
Bathrinath 2014 年 6 月 11 日
Thank you sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by