Check if all vector elements have same sign
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Oscar Frick
am 31 Mai 2018
Kommentiert: Oscar Frick
am 1 Jun. 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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!