Problem 57680. Compare a value to a vector
Given a random value X and a random vector Y. you have to compare X to the Vector Y and make a decision.
case 1: X is a value in between two values of Y, Then X should be ceiled to the higher value.
for example if X=5, Y = [3 7 1 4 2], then The value of X should be changed to 7.
case 2: X is higher than all the values of Y or equal to the highest value of Y, then X should be changed to NaN.
case 3: X is less than all the values of Y, then X should be ceiled to the least value of Y.
The output of the function should be X after modification.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers19
Suggested Problems
-
Sort a list of complex numbers based on far they are from the origin.
5790 Solvers
-
Back to basics 13 - Input variables
377 Solvers
-
Create a square matrix of multiples
495 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
676 Solvers
-
346 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!