Compares between numerical arrays up to a certain precision.
Updated 4 May 2016

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This program compares numerical arrays up to a certain precision.
>> numcmp(x); % compares x==0.1
>> numcmp(x,'<=',y,3); % compares x<=y up to 0.001

See the screenshot for another example.

This is usefull to compare serial dates up to 0.1 seconds by using:
>> numcmp(time1*86400,FUN,time2*86400)
and avoiding floating point problems with the serial dates in days.

Cite As

Carlos Adrian Vargas Aguilera (2024). numcmp.m (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Dates and Time in Help Center and MATLAB Answers

Inspired: Floating point relational operator.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

BSD License
Fixed bug with Infs inputs