Problem 45174. Given a vector x, return vector y with all negative elements from the vector x.
Given a vector x, return vector y with all negative elements from the vector x if x has negative elements. Otherwise return 0. for example: x=[1 2 3 4 -5 -2] y=[-5 -2] x=[1 2 3] y=0
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers65
Suggested Problems
-
Matrix indexing with two vectors of indices
709 Solvers
-
Reverse the elements of an array
986 Solvers
-
07 - Common functions and indexing 3
405 Solvers
-
1409 Solvers
-
1114 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!