Closest value
Version 1.4.0.0 (1.9 KB) by
Håvard Falck
Find the closest value to a given number in a vector
Given the number NUM, this function find the closest value to NUM in the vector VEC.
Only search within vector interval, and the vector must be non-monotonic decreasing.
Good for closest longitude/latitude searches etc.
Cite As
Håvard Falck (2024). Closest value (https://www.mathworks.com/matlabcentral/fileexchange/44505-closest-value), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2012b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Feature Detection and Extraction in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.