how to round up and down?

4 Ansichten (letzte 30 Tage)
Kobi
Kobi am 7 Aug. 2014
Kommentiert: Azzi Abdelmalek am 7 Aug. 2014
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?

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 7 Aug. 2014
sign(A).*ceil(abs(A))
  2 Kommentare
Kobi
Kobi am 7 Aug. 2014
thanks
Azzi Abdelmalek
Azzi Abdelmalek am 7 Aug. 2014
Or simply
sign(A)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by