Is there a way to define additional infix operators in MATLAB?
Specifically, I’d like to define two infix operators -> and <-> (these symbols would be ideal, but it could be a single character if necessary), which call functions implies and iff in the same way that & calls and and + calls plus.
function z = implies(x, y)
z = ~x|y;
function z = iff(x, y)
z = x&y | ~x&~y;
I’m happy to overload logical if necessary.
There is no way to define new Operators in MATLAB as several threads like this one suggest. However, if you’d like to overload an existing operator for you own class, here’s MATLAB’s documentation page, though I’m sure you’ve already seen it.