Check if all vector elements have same sign
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Oscar Frick
el 31 de Mayo de 2018
Comentada: Oscar Frick
el 1 de Jun. de 2018
Is there an efficient (and easy) way to check if all elements of a vector have the same sign (not caring about zero values)?
I can think of applying sign(v) and checking if all elements is equal to the first one after having removed all elements where sign(v)==0, but this fells somewhat clumsy. Is there an easier or more efficient way?
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Deep Learning Toolbox 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!