Borrar filtros
Borrar filtros

"uniques" giving duplicates... Matlab adding a tiny sum?

3 visualizaciones (últimos 30 días)
Doron
Doron el 23 de Feb. de 2012
Editada: Matt J el 22 de Oct. de 2013
When I look for the unique values of P in column 1, i get a duplicated 0.975...
Somewhere along the line, Matlab probably decided to add a 1 x 10^-28 to some of the cells or something!
I want the 0.975's to be the same, so that on a graph & legend, I no longer get duplicated lines.
:-)
Cause?
Solution?
Doron
>> PU = unique(P(:,1))
PU = ... 0.7000 0.8000 0.9000 0.9250 0.9500 0.9750 0.9750 1.0000

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Feb. de 2012
  4 comentarios
Sean de Wolski
Sean de Wolski el 23 de Feb. de 2012
We should sell floating point awareness tin foil hats.
Walter Roberson
Walter Roberson el 23 de Feb. de 2012
In some of my earlier incarnations, I had to assume that there might be compiler bugs in the floating point calculations. Not that such bugs were at all *common*, but you wouldn't want to bet someone's safety on the assumption that there were no invisible glitches.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by