I want to find the least negative non positive number in a vector
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aidan
am 9 Mär. 2024
Kommentiert: Star Strider
am 10 Mär. 2024
If I had a set like
[-10 , -5 , -1 , -0.1 , 0 , 1 , 2 , 3 , 4 , 5]
How could I write something to find -0.1 and print out its postion in the set. I want to find the highest value negitive number in a set.
1 Kommentar
Akzeptierte Antwort
Star Strider
am 10 Mär. 2024
Perhaps this —
V = [-10 , -5 , -1 , -0.1 , 0 , 1 , 2 , 3 , 4 , 5]
[Vmax,idx] = max(V(V<0))
V(idx)
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!