MATLAB: Overwriting built in function

eq built-innMATLAB

if i make a conditional statement where i compare 2 stings, i need to do this:
if strcmpi(string_1,string_2),
...
end
but the following looks much more elegant, and readable:
if string_1 == string_2
...
end
that is why i wrote the function
function y = eq(a,b)
y=strcmpi(a,b);
end
but this only works when i put the string in a cell like this:
if {string_1} == {string_2}
...
end
does anyone know why/ how to overrule the built-inn? also, why does an anonymous function ( eq=@(a,b)strcmpi(a,b); ) not work?

Best Answer

You can put your eq.m in a directory @char/. Its parent directory (not its contents) must be on the MATLAB path and higher up on the path than the builtin char methods.
However, I think it is a bad idea to overwrite builtin methods. You don't know what MathWorks-provided mfunctions might rely on the original str1==str2 definition, which you would be breaking.