how to change default behavior of 'times' function

2 次查看(过去 30 天)
I want to make the times function do element-wise operations by default in the obvious way, even for "non-conformable" matrices. The obvious way to do this would be to overload the times function in the following way:
function y=times(a,b); y=bsxfun(@times,a,b);
The problem with this is that once 'times' is overloaded, bsxfun calls the overloaded function instead of the builtin times function. Any ideas on how to fix this? (Obviously I could hard code the multiplication using the builtin command instead of using bsxfun but that would be slower so I don't want to do that.)

采纳的回答

Jonathan Sullivan
Jonathan Sullivan 2012-3-26

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Operators and Elementary Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by