You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Given a vector or matrix X, CLOSEST(X,b) finds the element in X that is nearest to the scalar b.
Example:
>> X = [-1 -2 6.14 9];
>> b = pi;
>> c = closest(X,b)
c =
6.14
Cite As
Matt (2026). Closest (https://www.mathworks.com/matlabcentral/fileexchange/42121-closest), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0.0 (1.17 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
