how to round up and down?

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by