I would like to redifine '+' function in MATLAB. Well my intention is not exactly to redefine +, instead I would like to create a new function ++ or $$ that would do the computation I need. Is this possible? I tried to define it as a function but merely defining as function doesn't help since it doesn't take such characters as function name. Is it possible to define a class of functions like ++ or or what ever, that can do the function I need?

 採用された回答

Lucas García
Lucas García 2011 年 8 月 28 日

1 投票

You should check object oriented programming with MATLAB and how to overload operators like '+'.
To start with:

3 件のコメント

Walter Roberson
Walter Roberson 2011 年 8 月 29 日
And for greater certainty: it is not possible to create new symbolic operator names in MATLAB, just to re-use ones that already exist.
Lucas García
Lucas García 2011 年 8 月 29 日
That's right, thanks for the clarification Walter. Only existing MATLAB operators can be overloaded. Unless you are are using the Symbolic Math Toolbox in MuPad, but that's a whole different story...(http://www.mathworks.com/help/toolbox/mupad/stdlib/operator.html)
Jyothy MJ
Jyothy MJ 2011 年 8 月 29 日
Thankyou Roberson and Garcia. That really helped.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by