Borrar filtros
Borrar filtros

how delete the '-' in front of numbers in a matrix?

3 visualizaciones (últimos 30 días)
elisa ewin
elisa ewin el 24 de Mayo de 2016
Editada: Guillaume el 24 de Mayo de 2016
Hi, I have this matrix
A=[2010 -10 -19 23;2010 -10 -18 22;2010 -10 -17 23;2010 -10 -17 19];
how can delete the '-' in front of the numbers?

Respuesta aceptada

the cyclist
the cyclist el 24 de Mayo de 2016
You mean you want to change all the negative numbers to positive numbers?
A = abs(A)
  1 comentario
Guillaume
Guillaume el 24 de Mayo de 2016
Editada: Guillaume el 24 de Mayo de 2016
The numbers look suspiciously like dates, so it's possible that the negative numbers are simply the result of bad parsing of the original string. While fixing the problem post-parsing is certainly valid, it's probably better in the long term to fix the parsing instead.
But that's worthy of another question by the OP.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by