Borrar filtros
Borrar filtros

How to write a condition ?

2 visualizaciones (últimos 30 días)
afef
afef el 23 de Mayo de 2017
Editada: dpb el 24 de Mayo de 2017
Hi, i have to write this condition in my code but i don't know how
moyenne <= '(-inf-6.95]'
  1 comentario
Jan
Jan el 23 de Mayo de 2017
Are you aware that the notation, you have invented, is not clear or unique? What exactly does the smaller than operator do with a string? What exactly is (-inf-6.95] ?
Do you mean: Moyenne is > -Inf and small or equal -6.95?

Iniciar sesión para comentar.

Respuestas (2)

dpb
dpb el 23 de Mayo de 2017
Editada: dpb el 24 de Mayo de 2017
Can't. Comparison operations always return logical 0 (false) where A or B have NaN elements.
Best you can do is test if result isfinite or not. See
doc isfinite % and friends for more information
ADDENDUM
OK, w/ the additional background try
Ayup...
moyenne<=-6.95
would give everything <= the breakpoint into that region, up to as large a negative value as can be represented. If the model can/does generate -Inf, that will have to be special-cased.
Jan's guess wasn't too far off, looks like
if sign(moyenne)*isinf(moyenne)==-1 | moyenne<=-6.95 % handle -Inf, too...
should do it. The first tests for -Inf and the other takes the case is finite but < than the breakpoint.
Do the similar thing on an unbounded upper bin as well.

Jan
Jan el 23 de Mayo de 2017
A bold guess:
isfinite(moyenne) & moyenne <= -6.95
  9 comentarios
afef
afef el 24 de Mayo de 2017
Editada: afef el 24 de Mayo de 2017
Ok so i should just put moyenne <= 6.95 ?
dpb
dpb el 24 de Mayo de 2017
Editada: dpb el 24 de Mayo de 2017
Yeah; expanded answer above based on comment...

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings 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