How do I use the "find" command to replace all values in a vector that meet a certain condition?
20 views (last 30 days)
Show older comments
I want to replace all values in vector V that are larger than 3 with a 3 using the "find" command.
V = [ 2 10 0 4 -2 7 -1 3 6 9 ]
Thanks for the help,
Erik
0 Comments
Accepted Answer
Azzi Abdelmalek
on 17 Nov 2014
Edited: Azzi Abdelmalek
on 17 Nov 2014
You don't need find function
v=[2 10 0 4 -2 7 -1 3 6 9]
v(v>3)=3
with find
v(find(v>3))=3
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!