help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Operator Overloading not working as expected


From: dkeck
Subject: Operator Overloading not working as expected
Date: Mon, 14 Jul 2014 13:02:51 -0700 (PDT)

I copied this
(http://stackoverflow.com/questions/5365464/matlab-is-it-possible-to-overload-operators-on-native-constructs-cells-struct)
source:

function C = plus(A,B)
  C = cellfun(@plus,A,B,'UniformOutput',false);
end

A = {[1 2 3] [4 5] 6};
B = {5 [4 5] 2};

>>A+B
error: binary operator '+' not implemented for 'cell' by 'cell' operations
>> plus(A,B)
ans =
{
  [1,1] =

     6   7   8

  [1,2] =

      8   10

  [1,3] =  8
}

The function call works well but how do I map the '+' sign correctly? Which
settings need to be manipulated/updated?



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Operator-Overloading-not-working-as-expected-tp4665479.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]