how to round up and down?

4 visualizaciones (últimos 30 días)
Kobi
Kobi el 7 de Ag. de 2014
Comentada: Azzi Abdelmalek el 7 de Ag. de 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?

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 7 de Ag. de 2014
sign(A).*ceil(abs(A))
  2 comentarios
Kobi
Kobi el 7 de Ag. de 2014
thanks
Azzi Abdelmalek
Azzi Abdelmalek el 7 de Ag. de 2014
Or simply
sign(A)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by