how to round up and down?

5 vues (au cours des 30 derniers jours)
Kobi
Kobi le 7 Août 2014
Commenté : Azzi Abdelmalek le 7 Août 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?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 7 Août 2014
sign(A).*ceil(abs(A))
  2 commentaires
Kobi
Kobi le 7 Août 2014
thanks
Azzi Abdelmalek
Azzi Abdelmalek le 7 Août 2014
Or simply
sign(A)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by