From: Matt J on
"Brandon Moore" <moorebj.nospamplease(a)umich.edu> wrote in message <i27fmg$huj$1(a)fred.mathworks.com>...
> > You could overload these with your own function.
>
> Sure. I guess I could write a local version of eq and use that instead of ==, but where's the fun in that? :) I have a clue how I would overload the actual == operator.
===============

If it's fun you're looking for, you can do a quick overloading of the == operator using my MatrixObj class

http://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly-definition-of-custom-matrix-objects

Depending on how you'll be using this, it could also be useful to you, as well as fun, but to keep the syntax brief, you would have to automate parts of my example below by encapsulating it in a function:

%%%%put this object setup in a function
l=MatrixObj;
l.Params.tol=.01; %tolerance parameter
l.Params.val=1; %Value parameter

l.Ops.eq=@(x,A) abs(A.Params.val-x)<=A.Params.tol;


%%%Example

>> sum([.4 .3 .2 .1001])==l %True within the tolerance of .01

ans =

1

>> sum([.4 .3 .2 .15])==l %False, even accounting for tolerance

ans =

0