I just got a problem with matlab programming. I’d like to try to call a method from a class and my class is very simple like this
classdef Addition
properties
a;
b;
end
methods
function obj = Addition(a, b)
obj.a = a;
obj.b = b;
end
function add(c, d)
fprintf(c + d);
end
end
end
I initialised a and try to call the add function by
a = Addition(1, 2)
a.add(2,4)
However, matlab gives me the error as:
Error using Addition/add
Too many input arguments.
Could somebody please tell me why this strange thing happened?