determination between Inf and -Inf

11 visualizaciones (últimos 30 días)
Al-Hussein Abutaleb
Al-Hussein Abutaleb el 22 de Jul. de 2016
Comentada: Azzi Abdelmalek el 22 de Jul. de 2016
Hello,
I have a matrix that contains both inf and -inf points. I'm currently using isinf() to find the locations of these points however I have no way of knowing whether it's -inf or +inf.
The reason for this is because I later replace each inf with a predetermine value (5000) and I would like to be able to replace -inf with -5000 (but so far I haven't been able to detect them. Sample code below:
data(isinf(data)) = max(model.ub); %the max here will return 5000;
Thanks Al

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 22 de Jul. de 2016
Editada: Azzi Abdelmalek el 22 de Jul. de 2016
a=[1 2 inf 3 -inf -4]
idx=isinf(a)
sign(a(idx))
  1 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 22 de Jul. de 2016
Al-Hussein Abutaleb commented
Brilliant!
Thank you! A

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Log Plots 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