how to round up and down?

4 ビュー (過去 30 日間)
Kobi
Kobi 2014 年 8 月 7 日
コメント済み: Azzi Abdelmalek 2014 年 8 月 7 日
i have the folowing matrix
ans =
0 0 0 0 -0.2500
0 0 0 0.7500 0
0 0 -0.2500 0 0
0 0.7500 0 0 0
-0.2500 0 0 0 0
i need to round it so the diognal elements are -1 1 -1 1 -1 how can i do this?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 7 日
sign(A).*ceil(abs(A))
  2 件のコメント
Kobi
Kobi 2014 年 8 月 7 日
thanks
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 7 日
Or simply
sign(A)

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by