how to round up and down?

4 visualizzazioni (ultimi 30 giorni)
Kobi
Kobi il 7 Ago 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?

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 7 Ago 2014
sign(A).*ceil(abs(A))

Più risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by